Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 9 | import struct |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10 | import loxi |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 11 | import const |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12 | import common |
| 13 | import action |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 14 | import util |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15 | import loxi.generic_util |
| 16 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 17 | class bsn_interface(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 18 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 19 | def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 20 | if hw_addr != None: |
| 21 | self.hw_addr = hw_addr |
| 22 | else: |
| 23 | self.hw_addr = [0,0,0,0,0,0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 24 | if name != None: |
| 25 | self.name = name |
| 26 | else: |
| 27 | self.name = "" |
| 28 | if ipv4_addr != None: |
| 29 | self.ipv4_addr = ipv4_addr |
| 30 | else: |
| 31 | self.ipv4_addr = 0 |
| 32 | if ipv4_netmask != None: |
| 33 | self.ipv4_netmask = ipv4_netmask |
| 34 | else: |
| 35 | self.ipv4_netmask = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 36 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 37 | |
| 38 | def pack(self): |
| 39 | packed = [] |
| 40 | packed.append(struct.pack("!6B", *self.hw_addr)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 41 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 42 | packed.append(struct.pack("!16s", self.name)) |
| 43 | packed.append(struct.pack("!L", self.ipv4_addr)) |
| 44 | packed.append(struct.pack("!L", self.ipv4_netmask)) |
| 45 | return ''.join(packed) |
| 46 | |
| 47 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 48 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 49 | obj = bsn_interface() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 50 | obj.hw_addr = list(reader.read('!6B')) |
| 51 | reader.skip(2) |
| 52 | obj.name = reader.read("!16s")[0].rstrip("\x00") |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 53 | obj.ipv4_addr = reader.read("!L")[0] |
| 54 | obj.ipv4_netmask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 55 | return obj |
| 56 | |
| 57 | def __eq__(self, other): |
| 58 | if type(self) != type(other): return False |
| 59 | if self.hw_addr != other.hw_addr: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 60 | if self.name != other.name: return False |
| 61 | if self.ipv4_addr != other.ipv4_addr: return False |
| 62 | if self.ipv4_netmask != other.ipv4_netmask: return False |
| 63 | return True |
| 64 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 65 | def pretty_print(self, q): |
| 66 | q.text("bsn_interface {") |
| 67 | with q.group(): |
| 68 | with q.indent(2): |
| 69 | q.breakable() |
| 70 | q.text("hw_addr = "); |
| 71 | q.text(util.pretty_mac(self.hw_addr)) |
| 72 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 73 | q.text("name = "); |
| 74 | q.pp(self.name) |
| 75 | q.text(","); q.breakable() |
| 76 | q.text("ipv4_addr = "); |
| 77 | q.text(util.pretty_ipv4(self.ipv4_addr)) |
| 78 | q.text(","); q.breakable() |
| 79 | q.text("ipv4_netmask = "); |
| 80 | q.text(util.pretty_ipv4(self.ipv4_netmask)) |
| 81 | q.breakable() |
| 82 | q.text('}') |
| 83 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 84 | |
| 85 | class bsn_vport(loxi.OFObject): |
| 86 | subtypes = {} |
| 87 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 88 | |
| 89 | def __init__(self, type=None): |
| 90 | if type != None: |
| 91 | self.type = type |
| 92 | else: |
| 93 | self.type = 0 |
| 94 | return |
| 95 | |
| 96 | def pack(self): |
| 97 | packed = [] |
| 98 | packed.append(struct.pack("!H", self.type)) |
| 99 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 100 | length = sum([len(x) for x in packed]) |
| 101 | packed[1] = struct.pack("!H", length) |
| 102 | return ''.join(packed) |
| 103 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 104 | @staticmethod |
| 105 | def unpack(reader): |
| 106 | subtype, = reader.peek('!H', 0) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 107 | subclass = bsn_vport.subtypes.get(subtype) |
| 108 | if subclass: |
| 109 | return subclass.unpack(reader) |
| 110 | |
| 111 | obj = bsn_vport() |
| 112 | obj.type = reader.read("!H")[0] |
| 113 | _length = reader.read("!H")[0] |
| 114 | orig_reader = reader |
| 115 | reader = orig_reader.slice(_length - (2 + 2)) |
| 116 | return obj |
| 117 | |
| 118 | def __eq__(self, other): |
| 119 | if type(self) != type(other): return False |
| 120 | if self.type != other.type: return False |
| 121 | return True |
| 122 | |
| 123 | def pretty_print(self, q): |
| 124 | q.text("bsn_vport {") |
| 125 | with q.group(): |
| 126 | with q.indent(2): |
| 127 | q.breakable() |
| 128 | q.breakable() |
| 129 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 130 | |
| 131 | |
| 132 | class bsn_vport_q_in_q(bsn_vport): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 133 | type = 0 |
| 134 | |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 135 | def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None, if_name=None): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 136 | if port_no != None: |
| 137 | self.port_no = port_no |
| 138 | else: |
| 139 | self.port_no = 0 |
| 140 | if ingress_tpid != None: |
| 141 | self.ingress_tpid = ingress_tpid |
| 142 | else: |
| 143 | self.ingress_tpid = 0 |
| 144 | if ingress_vlan_id != None: |
| 145 | self.ingress_vlan_id = ingress_vlan_id |
| 146 | else: |
| 147 | self.ingress_vlan_id = 0 |
| 148 | if egress_tpid != None: |
| 149 | self.egress_tpid = egress_tpid |
| 150 | else: |
| 151 | self.egress_tpid = 0 |
| 152 | if egress_vlan_id != None: |
| 153 | self.egress_vlan_id = egress_vlan_id |
| 154 | else: |
| 155 | self.egress_vlan_id = 0 |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 156 | if if_name != None: |
| 157 | self.if_name = if_name |
| 158 | else: |
| 159 | self.if_name = "" |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 160 | return |
| 161 | |
| 162 | def pack(self): |
| 163 | packed = [] |
| 164 | packed.append(struct.pack("!H", self.type)) |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 165 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 166 | packed.append(struct.pack("!L", self.port_no)) |
| 167 | packed.append(struct.pack("!H", self.ingress_tpid)) |
| 168 | packed.append(struct.pack("!H", self.ingress_vlan_id)) |
| 169 | packed.append(struct.pack("!H", self.egress_tpid)) |
| 170 | packed.append(struct.pack("!H", self.egress_vlan_id)) |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 171 | packed.append(struct.pack("!16s", self.if_name)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 172 | length = sum([len(x) for x in packed]) |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 173 | packed[1] = struct.pack("!H", length) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 174 | return ''.join(packed) |
| 175 | |
| 176 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 177 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 178 | obj = bsn_vport_q_in_q() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 179 | _type = reader.read("!H")[0] |
| 180 | assert(_type == 0) |
| 181 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 182 | orig_reader = reader |
| 183 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 184 | obj.port_no = reader.read("!L")[0] |
| 185 | obj.ingress_tpid = reader.read("!H")[0] |
| 186 | obj.ingress_vlan_id = reader.read("!H")[0] |
| 187 | obj.egress_tpid = reader.read("!H")[0] |
| 188 | obj.egress_vlan_id = reader.read("!H")[0] |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 189 | obj.if_name = reader.read("!16s")[0].rstrip("\x00") |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 190 | return obj |
| 191 | |
| 192 | def __eq__(self, other): |
| 193 | if type(self) != type(other): return False |
| 194 | if self.port_no != other.port_no: return False |
| 195 | if self.ingress_tpid != other.ingress_tpid: return False |
| 196 | if self.ingress_vlan_id != other.ingress_vlan_id: return False |
| 197 | if self.egress_tpid != other.egress_tpid: return False |
| 198 | if self.egress_vlan_id != other.egress_vlan_id: return False |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 199 | if self.if_name != other.if_name: return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 200 | return True |
| 201 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 202 | def pretty_print(self, q): |
| 203 | q.text("bsn_vport_q_in_q {") |
| 204 | with q.group(): |
| 205 | with q.indent(2): |
| 206 | q.breakable() |
| 207 | q.text("port_no = "); |
| 208 | q.text("%#x" % self.port_no) |
| 209 | q.text(","); q.breakable() |
| 210 | q.text("ingress_tpid = "); |
| 211 | q.text("%#x" % self.ingress_tpid) |
| 212 | q.text(","); q.breakable() |
| 213 | q.text("ingress_vlan_id = "); |
| 214 | q.text("%#x" % self.ingress_vlan_id) |
| 215 | q.text(","); q.breakable() |
| 216 | q.text("egress_tpid = "); |
| 217 | q.text("%#x" % self.egress_tpid) |
| 218 | q.text(","); q.breakable() |
| 219 | q.text("egress_vlan_id = "); |
| 220 | q.text("%#x" % self.egress_vlan_id) |
Kiran Poola | 150d8b0 | 2013-09-20 13:30:39 -0700 | [diff] [blame] | 221 | q.text(","); q.breakable() |
| 222 | q.text("if_name = "); |
| 223 | q.pp(self.if_name) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 224 | q.breakable() |
| 225 | q.text('}') |
| 226 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 227 | bsn_vport.subtypes[0] = bsn_vport_q_in_q |
| 228 | |
| 229 | class flow_stats_entry(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 230 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 231 | def __init__(self, table_id=None, match=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, cookie=None, packet_count=None, byte_count=None, actions=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 232 | if table_id != None: |
| 233 | self.table_id = table_id |
| 234 | else: |
| 235 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 236 | if match != None: |
| 237 | self.match = match |
| 238 | else: |
| 239 | self.match = common.match() |
| 240 | if duration_sec != None: |
| 241 | self.duration_sec = duration_sec |
| 242 | else: |
| 243 | self.duration_sec = 0 |
| 244 | if duration_nsec != None: |
| 245 | self.duration_nsec = duration_nsec |
| 246 | else: |
| 247 | self.duration_nsec = 0 |
| 248 | if priority != None: |
| 249 | self.priority = priority |
| 250 | else: |
| 251 | self.priority = 0 |
| 252 | if idle_timeout != None: |
| 253 | self.idle_timeout = idle_timeout |
| 254 | else: |
| 255 | self.idle_timeout = 0 |
| 256 | if hard_timeout != None: |
| 257 | self.hard_timeout = hard_timeout |
| 258 | else: |
| 259 | self.hard_timeout = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 260 | if cookie != None: |
| 261 | self.cookie = cookie |
| 262 | else: |
| 263 | self.cookie = 0 |
| 264 | if packet_count != None: |
| 265 | self.packet_count = packet_count |
| 266 | else: |
| 267 | self.packet_count = 0 |
| 268 | if byte_count != None: |
| 269 | self.byte_count = byte_count |
| 270 | else: |
| 271 | self.byte_count = 0 |
| 272 | if actions != None: |
| 273 | self.actions = actions |
| 274 | else: |
| 275 | self.actions = [] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 276 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 277 | |
| 278 | def pack(self): |
| 279 | packed = [] |
| 280 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 0 |
| 281 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 282 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 283 | packed.append(self.match.pack()) |
| 284 | packed.append(struct.pack("!L", self.duration_sec)) |
| 285 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 286 | packed.append(struct.pack("!H", self.priority)) |
| 287 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 288 | packed.append(struct.pack("!H", self.hard_timeout)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 289 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 290 | packed.append(struct.pack("!Q", self.cookie)) |
| 291 | packed.append(struct.pack("!Q", self.packet_count)) |
| 292 | packed.append(struct.pack("!Q", self.byte_count)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 293 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 294 | length = sum([len(x) for x in packed]) |
| 295 | packed[0] = struct.pack("!H", length) |
| 296 | return ''.join(packed) |
| 297 | |
| 298 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 299 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 300 | obj = flow_stats_entry() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 301 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 302 | orig_reader = reader |
| 303 | reader = orig_reader.slice(_length - (0 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 304 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 305 | reader.skip(1) |
| 306 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 307 | obj.duration_sec = reader.read("!L")[0] |
| 308 | obj.duration_nsec = reader.read("!L")[0] |
| 309 | obj.priority = reader.read("!H")[0] |
| 310 | obj.idle_timeout = reader.read("!H")[0] |
| 311 | obj.hard_timeout = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 312 | reader.skip(6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 313 | obj.cookie = reader.read("!Q")[0] |
| 314 | obj.packet_count = reader.read("!Q")[0] |
| 315 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 316 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 317 | return obj |
| 318 | |
| 319 | def __eq__(self, other): |
| 320 | if type(self) != type(other): return False |
| 321 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 322 | if self.match != other.match: return False |
| 323 | if self.duration_sec != other.duration_sec: return False |
| 324 | if self.duration_nsec != other.duration_nsec: return False |
| 325 | if self.priority != other.priority: return False |
| 326 | if self.idle_timeout != other.idle_timeout: return False |
| 327 | if self.hard_timeout != other.hard_timeout: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 328 | if self.cookie != other.cookie: return False |
| 329 | if self.packet_count != other.packet_count: return False |
| 330 | if self.byte_count != other.byte_count: return False |
| 331 | if self.actions != other.actions: return False |
| 332 | return True |
| 333 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 334 | def pretty_print(self, q): |
| 335 | q.text("flow_stats_entry {") |
| 336 | with q.group(): |
| 337 | with q.indent(2): |
| 338 | q.breakable() |
| 339 | q.text("table_id = "); |
| 340 | q.text("%#x" % self.table_id) |
| 341 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 342 | q.text("match = "); |
| 343 | q.pp(self.match) |
| 344 | q.text(","); q.breakable() |
| 345 | q.text("duration_sec = "); |
| 346 | q.text("%#x" % self.duration_sec) |
| 347 | q.text(","); q.breakable() |
| 348 | q.text("duration_nsec = "); |
| 349 | q.text("%#x" % self.duration_nsec) |
| 350 | q.text(","); q.breakable() |
| 351 | q.text("priority = "); |
| 352 | q.text("%#x" % self.priority) |
| 353 | q.text(","); q.breakable() |
| 354 | q.text("idle_timeout = "); |
| 355 | q.text("%#x" % self.idle_timeout) |
| 356 | q.text(","); q.breakable() |
| 357 | q.text("hard_timeout = "); |
| 358 | q.text("%#x" % self.hard_timeout) |
| 359 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 360 | q.text("cookie = "); |
| 361 | q.text("%#x" % self.cookie) |
| 362 | q.text(","); q.breakable() |
| 363 | q.text("packet_count = "); |
| 364 | q.text("%#x" % self.packet_count) |
| 365 | q.text(","); q.breakable() |
| 366 | q.text("byte_count = "); |
| 367 | q.text("%#x" % self.byte_count) |
| 368 | q.text(","); q.breakable() |
| 369 | q.text("actions = "); |
| 370 | q.pp(self.actions) |
| 371 | q.breakable() |
| 372 | q.text('}') |
| 373 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 374 | |
| 375 | class match_v1(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 376 | |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 377 | def __init__(self, wildcards=None, in_port=None, eth_src=None, eth_dst=None, vlan_vid=None, vlan_pcp=None, eth_type=None, ip_dscp=None, ip_proto=None, ipv4_src=None, ipv4_dst=None, tcp_src=None, tcp_dst=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 378 | if wildcards != None: |
| 379 | self.wildcards = wildcards |
| 380 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 381 | self.wildcards = util.init_wc_bmap() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 382 | if in_port != None: |
| 383 | self.in_port = in_port |
| 384 | else: |
| 385 | self.in_port = 0 |
| 386 | if eth_src != None: |
| 387 | self.eth_src = eth_src |
| 388 | else: |
| 389 | self.eth_src = [0,0,0,0,0,0] |
| 390 | if eth_dst != None: |
| 391 | self.eth_dst = eth_dst |
| 392 | else: |
| 393 | self.eth_dst = [0,0,0,0,0,0] |
| 394 | if vlan_vid != None: |
| 395 | self.vlan_vid = vlan_vid |
| 396 | else: |
| 397 | self.vlan_vid = 0 |
| 398 | if vlan_pcp != None: |
| 399 | self.vlan_pcp = vlan_pcp |
| 400 | else: |
| 401 | self.vlan_pcp = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 402 | if eth_type != None: |
| 403 | self.eth_type = eth_type |
| 404 | else: |
| 405 | self.eth_type = 0 |
| 406 | if ip_dscp != None: |
| 407 | self.ip_dscp = ip_dscp |
| 408 | else: |
| 409 | self.ip_dscp = 0 |
| 410 | if ip_proto != None: |
| 411 | self.ip_proto = ip_proto |
| 412 | else: |
| 413 | self.ip_proto = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 414 | if ipv4_src != None: |
| 415 | self.ipv4_src = ipv4_src |
| 416 | else: |
| 417 | self.ipv4_src = 0 |
| 418 | if ipv4_dst != None: |
| 419 | self.ipv4_dst = ipv4_dst |
| 420 | else: |
| 421 | self.ipv4_dst = 0 |
| 422 | if tcp_src != None: |
| 423 | self.tcp_src = tcp_src |
| 424 | else: |
| 425 | self.tcp_src = 0 |
| 426 | if tcp_dst != None: |
| 427 | self.tcp_dst = tcp_dst |
| 428 | else: |
| 429 | self.tcp_dst = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 430 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 431 | |
| 432 | def pack(self): |
| 433 | packed = [] |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 434 | packed.append(util.pack_wc_bmap(self.wildcards)) |
| 435 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 436 | packed.append(struct.pack("!6B", *self.eth_src)) |
| 437 | packed.append(struct.pack("!6B", *self.eth_dst)) |
| 438 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 439 | packed.append(struct.pack("!B", self.vlan_pcp)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 440 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 441 | packed.append(struct.pack("!H", self.eth_type)) |
| 442 | packed.append(struct.pack("!B", self.ip_dscp)) |
| 443 | packed.append(struct.pack("!B", self.ip_proto)) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 444 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 445 | packed.append(struct.pack("!L", self.ipv4_src)) |
| 446 | packed.append(struct.pack("!L", self.ipv4_dst)) |
| 447 | packed.append(struct.pack("!H", self.tcp_src)) |
| 448 | packed.append(struct.pack("!H", self.tcp_dst)) |
| 449 | return ''.join(packed) |
| 450 | |
| 451 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 452 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 453 | obj = match_v1() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 454 | obj.wildcards = util.unpack_wc_bmap(reader) |
| 455 | obj.in_port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 456 | obj.eth_src = list(reader.read('!6B')) |
| 457 | obj.eth_dst = list(reader.read('!6B')) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 458 | obj.vlan_vid = reader.read("!H")[0] |
| 459 | obj.vlan_pcp = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 460 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 461 | obj.eth_type = reader.read("!H")[0] |
| 462 | obj.ip_dscp = reader.read("!B")[0] |
| 463 | obj.ip_proto = reader.read("!B")[0] |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 464 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 465 | obj.ipv4_src = reader.read("!L")[0] |
| 466 | obj.ipv4_dst = reader.read("!L")[0] |
| 467 | obj.tcp_src = reader.read("!H")[0] |
| 468 | obj.tcp_dst = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 469 | return obj |
| 470 | |
| 471 | def __eq__(self, other): |
| 472 | if type(self) != type(other): return False |
| 473 | if self.wildcards != other.wildcards: return False |
| 474 | if self.in_port != other.in_port: return False |
| 475 | if self.eth_src != other.eth_src: return False |
| 476 | if self.eth_dst != other.eth_dst: return False |
| 477 | if self.vlan_vid != other.vlan_vid: return False |
| 478 | if self.vlan_pcp != other.vlan_pcp: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 479 | if self.eth_type != other.eth_type: return False |
| 480 | if self.ip_dscp != other.ip_dscp: return False |
| 481 | if self.ip_proto != other.ip_proto: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 482 | if self.ipv4_src != other.ipv4_src: return False |
| 483 | if self.ipv4_dst != other.ipv4_dst: return False |
| 484 | if self.tcp_src != other.tcp_src: return False |
| 485 | if self.tcp_dst != other.tcp_dst: return False |
| 486 | return True |
| 487 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 488 | def pretty_print(self, q): |
| 489 | q.text("match_v1 {") |
| 490 | with q.group(): |
| 491 | with q.indent(2): |
| 492 | q.breakable() |
| 493 | q.text("wildcards = "); |
| 494 | q.text(util.pretty_wildcards(self.wildcards)) |
| 495 | q.text(","); q.breakable() |
| 496 | q.text("in_port = "); |
| 497 | q.text(util.pretty_port(self.in_port)) |
| 498 | q.text(","); q.breakable() |
| 499 | q.text("eth_src = "); |
| 500 | q.text(util.pretty_mac(self.eth_src)) |
| 501 | q.text(","); q.breakable() |
| 502 | q.text("eth_dst = "); |
| 503 | q.text(util.pretty_mac(self.eth_dst)) |
| 504 | q.text(","); q.breakable() |
| 505 | q.text("vlan_vid = "); |
| 506 | q.text("%#x" % self.vlan_vid) |
| 507 | q.text(","); q.breakable() |
| 508 | q.text("vlan_pcp = "); |
| 509 | q.text("%#x" % self.vlan_pcp) |
| 510 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 511 | q.text("eth_type = "); |
| 512 | q.text("%#x" % self.eth_type) |
| 513 | q.text(","); q.breakable() |
| 514 | q.text("ip_dscp = "); |
| 515 | q.text("%#x" % self.ip_dscp) |
| 516 | q.text(","); q.breakable() |
| 517 | q.text("ip_proto = "); |
| 518 | q.text("%#x" % self.ip_proto) |
| 519 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 520 | q.text("ipv4_src = "); |
| 521 | q.text(util.pretty_ipv4(self.ipv4_src)) |
| 522 | q.text(","); q.breakable() |
| 523 | q.text("ipv4_dst = "); |
| 524 | q.text(util.pretty_ipv4(self.ipv4_dst)) |
| 525 | q.text(","); q.breakable() |
| 526 | q.text("tcp_src = "); |
| 527 | q.text("%#x" % self.tcp_src) |
| 528 | q.text(","); q.breakable() |
| 529 | q.text("tcp_dst = "); |
| 530 | q.text("%#x" % self.tcp_dst) |
| 531 | q.breakable() |
| 532 | q.text('}') |
| 533 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 534 | |
| 535 | class packet_queue(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 536 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 537 | def __init__(self, queue_id=None, properties=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 538 | if queue_id != None: |
| 539 | self.queue_id = queue_id |
| 540 | else: |
| 541 | self.queue_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 542 | if properties != None: |
| 543 | self.properties = properties |
| 544 | else: |
| 545 | self.properties = [] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 546 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 547 | |
| 548 | def pack(self): |
| 549 | packed = [] |
| 550 | packed.append(struct.pack("!L", self.queue_id)) |
| 551 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 552 | packed.append('\x00' * 2) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 553 | packed.append(loxi.generic_util.pack_list(self.properties)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 554 | length = sum([len(x) for x in packed]) |
| 555 | packed[1] = struct.pack("!H", length) |
| 556 | return ''.join(packed) |
| 557 | |
| 558 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 559 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 560 | obj = packet_queue() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 561 | obj.queue_id = reader.read("!L")[0] |
| 562 | _len = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 563 | orig_reader = reader |
| 564 | reader = orig_reader.slice(_len - (4 + 2)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 565 | reader.skip(2) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 566 | obj.properties = loxi.generic_util.unpack_list(reader, common.queue_prop.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 567 | return obj |
| 568 | |
| 569 | def __eq__(self, other): |
| 570 | if type(self) != type(other): return False |
| 571 | if self.queue_id != other.queue_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 572 | if self.properties != other.properties: return False |
| 573 | return True |
| 574 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 575 | def pretty_print(self, q): |
| 576 | q.text("packet_queue {") |
| 577 | with q.group(): |
| 578 | with q.indent(2): |
| 579 | q.breakable() |
| 580 | q.text("queue_id = "); |
| 581 | q.text("%#x" % self.queue_id) |
| 582 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 583 | q.text("properties = "); |
| 584 | q.pp(self.properties) |
| 585 | q.breakable() |
| 586 | q.text('}') |
| 587 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 588 | |
| 589 | class port_desc(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 590 | |
| 591 | def __init__(self, port_no=None, hw_addr=None, name=None, config=None, state=None, curr=None, advertised=None, supported=None, peer=None): |
| 592 | if port_no != None: |
| 593 | self.port_no = port_no |
| 594 | else: |
| 595 | self.port_no = 0 |
| 596 | if hw_addr != None: |
| 597 | self.hw_addr = hw_addr |
| 598 | else: |
| 599 | self.hw_addr = [0,0,0,0,0,0] |
| 600 | if name != None: |
| 601 | self.name = name |
| 602 | else: |
| 603 | self.name = "" |
| 604 | if config != None: |
| 605 | self.config = config |
| 606 | else: |
| 607 | self.config = 0 |
| 608 | if state != None: |
| 609 | self.state = state |
| 610 | else: |
| 611 | self.state = 0 |
| 612 | if curr != None: |
| 613 | self.curr = curr |
| 614 | else: |
| 615 | self.curr = 0 |
| 616 | if advertised != None: |
| 617 | self.advertised = advertised |
| 618 | else: |
| 619 | self.advertised = 0 |
| 620 | if supported != None: |
| 621 | self.supported = supported |
| 622 | else: |
| 623 | self.supported = 0 |
| 624 | if peer != None: |
| 625 | self.peer = peer |
| 626 | else: |
| 627 | self.peer = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 628 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 629 | |
| 630 | def pack(self): |
| 631 | packed = [] |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 632 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 633 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 634 | packed.append(struct.pack("!16s", self.name)) |
| 635 | packed.append(struct.pack("!L", self.config)) |
| 636 | packed.append(struct.pack("!L", self.state)) |
| 637 | packed.append(struct.pack("!L", self.curr)) |
| 638 | packed.append(struct.pack("!L", self.advertised)) |
| 639 | packed.append(struct.pack("!L", self.supported)) |
| 640 | packed.append(struct.pack("!L", self.peer)) |
| 641 | return ''.join(packed) |
| 642 | |
| 643 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 644 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 645 | obj = port_desc() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 646 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 647 | obj.hw_addr = list(reader.read('!6B')) |
| 648 | obj.name = reader.read("!16s")[0].rstrip("\x00") |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 649 | obj.config = reader.read("!L")[0] |
| 650 | obj.state = reader.read("!L")[0] |
| 651 | obj.curr = reader.read("!L")[0] |
| 652 | obj.advertised = reader.read("!L")[0] |
| 653 | obj.supported = reader.read("!L")[0] |
| 654 | obj.peer = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 655 | return obj |
| 656 | |
| 657 | def __eq__(self, other): |
| 658 | if type(self) != type(other): return False |
| 659 | if self.port_no != other.port_no: return False |
| 660 | if self.hw_addr != other.hw_addr: return False |
| 661 | if self.name != other.name: return False |
| 662 | if self.config != other.config: return False |
| 663 | if self.state != other.state: return False |
| 664 | if self.curr != other.curr: return False |
| 665 | if self.advertised != other.advertised: return False |
| 666 | if self.supported != other.supported: return False |
| 667 | if self.peer != other.peer: return False |
| 668 | return True |
| 669 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 670 | def pretty_print(self, q): |
| 671 | q.text("port_desc {") |
| 672 | with q.group(): |
| 673 | with q.indent(2): |
| 674 | q.breakable() |
| 675 | q.text("port_no = "); |
| 676 | q.text(util.pretty_port(self.port_no)) |
| 677 | q.text(","); q.breakable() |
| 678 | q.text("hw_addr = "); |
| 679 | q.text(util.pretty_mac(self.hw_addr)) |
| 680 | q.text(","); q.breakable() |
| 681 | q.text("name = "); |
| 682 | q.pp(self.name) |
| 683 | q.text(","); q.breakable() |
| 684 | q.text("config = "); |
| 685 | q.text("%#x" % self.config) |
| 686 | q.text(","); q.breakable() |
| 687 | q.text("state = "); |
| 688 | q.text("%#x" % self.state) |
| 689 | q.text(","); q.breakable() |
| 690 | q.text("curr = "); |
| 691 | q.text("%#x" % self.curr) |
| 692 | q.text(","); q.breakable() |
| 693 | q.text("advertised = "); |
| 694 | q.text("%#x" % self.advertised) |
| 695 | q.text(","); q.breakable() |
| 696 | q.text("supported = "); |
| 697 | q.text("%#x" % self.supported) |
| 698 | q.text(","); q.breakable() |
| 699 | q.text("peer = "); |
| 700 | q.text("%#x" % self.peer) |
| 701 | q.breakable() |
| 702 | q.text('}') |
| 703 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 704 | |
| 705 | class port_stats_entry(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 706 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 707 | def __init__(self, port_no=None, rx_packets=None, tx_packets=None, rx_bytes=None, tx_bytes=None, rx_dropped=None, tx_dropped=None, rx_errors=None, tx_errors=None, rx_frame_err=None, rx_over_err=None, rx_crc_err=None, collisions=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 708 | if port_no != None: |
| 709 | self.port_no = port_no |
| 710 | else: |
| 711 | self.port_no = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 712 | if rx_packets != None: |
| 713 | self.rx_packets = rx_packets |
| 714 | else: |
| 715 | self.rx_packets = 0 |
| 716 | if tx_packets != None: |
| 717 | self.tx_packets = tx_packets |
| 718 | else: |
| 719 | self.tx_packets = 0 |
| 720 | if rx_bytes != None: |
| 721 | self.rx_bytes = rx_bytes |
| 722 | else: |
| 723 | self.rx_bytes = 0 |
| 724 | if tx_bytes != None: |
| 725 | self.tx_bytes = tx_bytes |
| 726 | else: |
| 727 | self.tx_bytes = 0 |
| 728 | if rx_dropped != None: |
| 729 | self.rx_dropped = rx_dropped |
| 730 | else: |
| 731 | self.rx_dropped = 0 |
| 732 | if tx_dropped != None: |
| 733 | self.tx_dropped = tx_dropped |
| 734 | else: |
| 735 | self.tx_dropped = 0 |
| 736 | if rx_errors != None: |
| 737 | self.rx_errors = rx_errors |
| 738 | else: |
| 739 | self.rx_errors = 0 |
| 740 | if tx_errors != None: |
| 741 | self.tx_errors = tx_errors |
| 742 | else: |
| 743 | self.tx_errors = 0 |
| 744 | if rx_frame_err != None: |
| 745 | self.rx_frame_err = rx_frame_err |
| 746 | else: |
| 747 | self.rx_frame_err = 0 |
| 748 | if rx_over_err != None: |
| 749 | self.rx_over_err = rx_over_err |
| 750 | else: |
| 751 | self.rx_over_err = 0 |
| 752 | if rx_crc_err != None: |
| 753 | self.rx_crc_err = rx_crc_err |
| 754 | else: |
| 755 | self.rx_crc_err = 0 |
| 756 | if collisions != None: |
| 757 | self.collisions = collisions |
| 758 | else: |
| 759 | self.collisions = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 760 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 761 | |
| 762 | def pack(self): |
| 763 | packed = [] |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 764 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 765 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 766 | packed.append(struct.pack("!Q", self.rx_packets)) |
| 767 | packed.append(struct.pack("!Q", self.tx_packets)) |
| 768 | packed.append(struct.pack("!Q", self.rx_bytes)) |
| 769 | packed.append(struct.pack("!Q", self.tx_bytes)) |
| 770 | packed.append(struct.pack("!Q", self.rx_dropped)) |
| 771 | packed.append(struct.pack("!Q", self.tx_dropped)) |
| 772 | packed.append(struct.pack("!Q", self.rx_errors)) |
| 773 | packed.append(struct.pack("!Q", self.tx_errors)) |
| 774 | packed.append(struct.pack("!Q", self.rx_frame_err)) |
| 775 | packed.append(struct.pack("!Q", self.rx_over_err)) |
| 776 | packed.append(struct.pack("!Q", self.rx_crc_err)) |
| 777 | packed.append(struct.pack("!Q", self.collisions)) |
| 778 | return ''.join(packed) |
| 779 | |
| 780 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 781 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 782 | obj = port_stats_entry() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 783 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 784 | reader.skip(6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 785 | obj.rx_packets = reader.read("!Q")[0] |
| 786 | obj.tx_packets = reader.read("!Q")[0] |
| 787 | obj.rx_bytes = reader.read("!Q")[0] |
| 788 | obj.tx_bytes = reader.read("!Q")[0] |
| 789 | obj.rx_dropped = reader.read("!Q")[0] |
| 790 | obj.tx_dropped = reader.read("!Q")[0] |
| 791 | obj.rx_errors = reader.read("!Q")[0] |
| 792 | obj.tx_errors = reader.read("!Q")[0] |
| 793 | obj.rx_frame_err = reader.read("!Q")[0] |
| 794 | obj.rx_over_err = reader.read("!Q")[0] |
| 795 | obj.rx_crc_err = reader.read("!Q")[0] |
| 796 | obj.collisions = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 797 | return obj |
| 798 | |
| 799 | def __eq__(self, other): |
| 800 | if type(self) != type(other): return False |
| 801 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 802 | if self.rx_packets != other.rx_packets: return False |
| 803 | if self.tx_packets != other.tx_packets: return False |
| 804 | if self.rx_bytes != other.rx_bytes: return False |
| 805 | if self.tx_bytes != other.tx_bytes: return False |
| 806 | if self.rx_dropped != other.rx_dropped: return False |
| 807 | if self.tx_dropped != other.tx_dropped: return False |
| 808 | if self.rx_errors != other.rx_errors: return False |
| 809 | if self.tx_errors != other.tx_errors: return False |
| 810 | if self.rx_frame_err != other.rx_frame_err: return False |
| 811 | if self.rx_over_err != other.rx_over_err: return False |
| 812 | if self.rx_crc_err != other.rx_crc_err: return False |
| 813 | if self.collisions != other.collisions: return False |
| 814 | return True |
| 815 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 816 | def pretty_print(self, q): |
| 817 | q.text("port_stats_entry {") |
| 818 | with q.group(): |
| 819 | with q.indent(2): |
| 820 | q.breakable() |
| 821 | q.text("port_no = "); |
| 822 | q.text(util.pretty_port(self.port_no)) |
| 823 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 824 | q.text("rx_packets = "); |
| 825 | q.text("%#x" % self.rx_packets) |
| 826 | q.text(","); q.breakable() |
| 827 | q.text("tx_packets = "); |
| 828 | q.text("%#x" % self.tx_packets) |
| 829 | q.text(","); q.breakable() |
| 830 | q.text("rx_bytes = "); |
| 831 | q.text("%#x" % self.rx_bytes) |
| 832 | q.text(","); q.breakable() |
| 833 | q.text("tx_bytes = "); |
| 834 | q.text("%#x" % self.tx_bytes) |
| 835 | q.text(","); q.breakable() |
| 836 | q.text("rx_dropped = "); |
| 837 | q.text("%#x" % self.rx_dropped) |
| 838 | q.text(","); q.breakable() |
| 839 | q.text("tx_dropped = "); |
| 840 | q.text("%#x" % self.tx_dropped) |
| 841 | q.text(","); q.breakable() |
| 842 | q.text("rx_errors = "); |
| 843 | q.text("%#x" % self.rx_errors) |
| 844 | q.text(","); q.breakable() |
| 845 | q.text("tx_errors = "); |
| 846 | q.text("%#x" % self.tx_errors) |
| 847 | q.text(","); q.breakable() |
| 848 | q.text("rx_frame_err = "); |
| 849 | q.text("%#x" % self.rx_frame_err) |
| 850 | q.text(","); q.breakable() |
| 851 | q.text("rx_over_err = "); |
| 852 | q.text("%#x" % self.rx_over_err) |
| 853 | q.text(","); q.breakable() |
| 854 | q.text("rx_crc_err = "); |
| 855 | q.text("%#x" % self.rx_crc_err) |
| 856 | q.text(","); q.breakable() |
| 857 | q.text("collisions = "); |
| 858 | q.text("%#x" % self.collisions) |
| 859 | q.breakable() |
| 860 | q.text('}') |
| 861 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 862 | |
| 863 | class queue_prop(loxi.OFObject): |
| 864 | subtypes = {} |
| 865 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 866 | |
| 867 | def __init__(self, type=None): |
| 868 | if type != None: |
| 869 | self.type = type |
| 870 | else: |
| 871 | self.type = 0 |
| 872 | return |
| 873 | |
| 874 | def pack(self): |
| 875 | packed = [] |
| 876 | packed.append(struct.pack("!H", self.type)) |
| 877 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 878 | packed.append('\x00' * 4) |
| 879 | length = sum([len(x) for x in packed]) |
| 880 | packed[1] = struct.pack("!H", length) |
| 881 | return ''.join(packed) |
| 882 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 883 | @staticmethod |
| 884 | def unpack(reader): |
| 885 | subtype, = reader.peek('!H', 0) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 886 | subclass = queue_prop.subtypes.get(subtype) |
| 887 | if subclass: |
| 888 | return subclass.unpack(reader) |
| 889 | |
| 890 | obj = queue_prop() |
| 891 | obj.type = reader.read("!H")[0] |
| 892 | _len = reader.read("!H")[0] |
| 893 | orig_reader = reader |
| 894 | reader = orig_reader.slice(_len - (2 + 2)) |
| 895 | reader.skip(4) |
| 896 | return obj |
| 897 | |
| 898 | def __eq__(self, other): |
| 899 | if type(self) != type(other): return False |
| 900 | if self.type != other.type: return False |
| 901 | return True |
| 902 | |
| 903 | def pretty_print(self, q): |
| 904 | q.text("queue_prop {") |
| 905 | with q.group(): |
| 906 | with q.indent(2): |
| 907 | q.breakable() |
| 908 | q.breakable() |
| 909 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 910 | |
| 911 | |
| 912 | class queue_prop_min_rate(queue_prop): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 913 | type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 914 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 915 | def __init__(self, rate=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 916 | if rate != None: |
| 917 | self.rate = rate |
| 918 | else: |
| 919 | self.rate = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 920 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 921 | |
| 922 | def pack(self): |
| 923 | packed = [] |
| 924 | packed.append(struct.pack("!H", self.type)) |
| 925 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 926 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 927 | packed.append(struct.pack("!H", self.rate)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 928 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 929 | length = sum([len(x) for x in packed]) |
| 930 | packed[1] = struct.pack("!H", length) |
| 931 | return ''.join(packed) |
| 932 | |
| 933 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 934 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 935 | obj = queue_prop_min_rate() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 936 | _type = reader.read("!H")[0] |
| 937 | assert(_type == 1) |
| 938 | _len = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 939 | orig_reader = reader |
| 940 | reader = orig_reader.slice(_len - (2 + 2)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 941 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 942 | obj.rate = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 943 | reader.skip(6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 944 | return obj |
| 945 | |
| 946 | def __eq__(self, other): |
| 947 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 948 | if self.rate != other.rate: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 949 | return True |
| 950 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 951 | def pretty_print(self, q): |
| 952 | q.text("queue_prop_min_rate {") |
| 953 | with q.group(): |
| 954 | with q.indent(2): |
| 955 | q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 956 | q.text("rate = "); |
| 957 | q.text("%#x" % self.rate) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 958 | q.breakable() |
| 959 | q.text('}') |
| 960 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 961 | queue_prop.subtypes[1] = queue_prop_min_rate |
| 962 | |
| 963 | class queue_stats_entry(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 964 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 965 | def __init__(self, port_no=None, queue_id=None, tx_bytes=None, tx_packets=None, tx_errors=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 966 | if port_no != None: |
| 967 | self.port_no = port_no |
| 968 | else: |
| 969 | self.port_no = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 970 | if queue_id != None: |
| 971 | self.queue_id = queue_id |
| 972 | else: |
| 973 | self.queue_id = 0 |
| 974 | if tx_bytes != None: |
| 975 | self.tx_bytes = tx_bytes |
| 976 | else: |
| 977 | self.tx_bytes = 0 |
| 978 | if tx_packets != None: |
| 979 | self.tx_packets = tx_packets |
| 980 | else: |
| 981 | self.tx_packets = 0 |
| 982 | if tx_errors != None: |
| 983 | self.tx_errors = tx_errors |
| 984 | else: |
| 985 | self.tx_errors = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 986 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 987 | |
| 988 | def pack(self): |
| 989 | packed = [] |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 990 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 991 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 992 | packed.append(struct.pack("!L", self.queue_id)) |
| 993 | packed.append(struct.pack("!Q", self.tx_bytes)) |
| 994 | packed.append(struct.pack("!Q", self.tx_packets)) |
| 995 | packed.append(struct.pack("!Q", self.tx_errors)) |
| 996 | return ''.join(packed) |
| 997 | |
| 998 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 999 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1000 | obj = queue_stats_entry() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1001 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1002 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1003 | obj.queue_id = reader.read("!L")[0] |
| 1004 | obj.tx_bytes = reader.read("!Q")[0] |
| 1005 | obj.tx_packets = reader.read("!Q")[0] |
| 1006 | obj.tx_errors = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1007 | return obj |
| 1008 | |
| 1009 | def __eq__(self, other): |
| 1010 | if type(self) != type(other): return False |
| 1011 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1012 | if self.queue_id != other.queue_id: return False |
| 1013 | if self.tx_bytes != other.tx_bytes: return False |
| 1014 | if self.tx_packets != other.tx_packets: return False |
| 1015 | if self.tx_errors != other.tx_errors: return False |
| 1016 | return True |
| 1017 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1018 | def pretty_print(self, q): |
| 1019 | q.text("queue_stats_entry {") |
| 1020 | with q.group(): |
| 1021 | with q.indent(2): |
| 1022 | q.breakable() |
| 1023 | q.text("port_no = "); |
| 1024 | q.text(util.pretty_port(self.port_no)) |
| 1025 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1026 | q.text("queue_id = "); |
| 1027 | q.text("%#x" % self.queue_id) |
| 1028 | q.text(","); q.breakable() |
| 1029 | q.text("tx_bytes = "); |
| 1030 | q.text("%#x" % self.tx_bytes) |
| 1031 | q.text(","); q.breakable() |
| 1032 | q.text("tx_packets = "); |
| 1033 | q.text("%#x" % self.tx_packets) |
| 1034 | q.text(","); q.breakable() |
| 1035 | q.text("tx_errors = "); |
| 1036 | q.text("%#x" % self.tx_errors) |
| 1037 | q.breakable() |
| 1038 | q.text('}') |
| 1039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1040 | |
| 1041 | class table_stats_entry(loxi.OFObject): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1042 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1043 | def __init__(self, table_id=None, name=None, wildcards=None, max_entries=None, active_count=None, lookup_count=None, matched_count=None): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1044 | if table_id != None: |
| 1045 | self.table_id = table_id |
| 1046 | else: |
| 1047 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1048 | if name != None: |
| 1049 | self.name = name |
| 1050 | else: |
| 1051 | self.name = "" |
| 1052 | if wildcards != None: |
| 1053 | self.wildcards = wildcards |
| 1054 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1055 | self.wildcards = util.init_wc_bmap() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1056 | if max_entries != None: |
| 1057 | self.max_entries = max_entries |
| 1058 | else: |
| 1059 | self.max_entries = 0 |
| 1060 | if active_count != None: |
| 1061 | self.active_count = active_count |
| 1062 | else: |
| 1063 | self.active_count = 0 |
| 1064 | if lookup_count != None: |
| 1065 | self.lookup_count = lookup_count |
| 1066 | else: |
| 1067 | self.lookup_count = 0 |
| 1068 | if matched_count != None: |
| 1069 | self.matched_count = matched_count |
| 1070 | else: |
| 1071 | self.matched_count = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1072 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1073 | |
| 1074 | def pack(self): |
| 1075 | packed = [] |
| 1076 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1077 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1078 | packed.append(struct.pack("!32s", self.name)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1079 | packed.append(util.pack_wc_bmap(self.wildcards)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1080 | packed.append(struct.pack("!L", self.max_entries)) |
| 1081 | packed.append(struct.pack("!L", self.active_count)) |
| 1082 | packed.append(struct.pack("!Q", self.lookup_count)) |
| 1083 | packed.append(struct.pack("!Q", self.matched_count)) |
| 1084 | return ''.join(packed) |
| 1085 | |
| 1086 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1087 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1088 | obj = table_stats_entry() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1089 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1090 | reader.skip(3) |
| 1091 | obj.name = reader.read("!32s")[0].rstrip("\x00") |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1092 | obj.wildcards = util.unpack_wc_bmap(reader) |
| 1093 | obj.max_entries = reader.read("!L")[0] |
| 1094 | obj.active_count = reader.read("!L")[0] |
| 1095 | obj.lookup_count = reader.read("!Q")[0] |
| 1096 | obj.matched_count = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1097 | return obj |
| 1098 | |
| 1099 | def __eq__(self, other): |
| 1100 | if type(self) != type(other): return False |
| 1101 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1102 | if self.name != other.name: return False |
| 1103 | if self.wildcards != other.wildcards: return False |
| 1104 | if self.max_entries != other.max_entries: return False |
| 1105 | if self.active_count != other.active_count: return False |
| 1106 | if self.lookup_count != other.lookup_count: return False |
| 1107 | if self.matched_count != other.matched_count: return False |
| 1108 | return True |
| 1109 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1110 | def pretty_print(self, q): |
| 1111 | q.text("table_stats_entry {") |
| 1112 | with q.group(): |
| 1113 | with q.indent(2): |
| 1114 | q.breakable() |
| 1115 | q.text("table_id = "); |
| 1116 | q.text("%#x" % self.table_id) |
| 1117 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1118 | q.text("name = "); |
| 1119 | q.pp(self.name) |
| 1120 | q.text(","); q.breakable() |
| 1121 | q.text("wildcards = "); |
| 1122 | q.text(util.pretty_wildcards(self.wildcards)) |
| 1123 | q.text(","); q.breakable() |
| 1124 | q.text("max_entries = "); |
| 1125 | q.text("%#x" % self.max_entries) |
| 1126 | q.text(","); q.breakable() |
| 1127 | q.text("active_count = "); |
| 1128 | q.text("%#x" % self.active_count) |
| 1129 | q.text(","); q.breakable() |
| 1130 | q.text("lookup_count = "); |
| 1131 | q.text("%#x" % self.lookup_count) |
| 1132 | q.text(","); q.breakable() |
| 1133 | q.text("matched_count = "); |
| 1134 | q.text("%#x" % self.matched_count) |
| 1135 | q.breakable() |
| 1136 | q.text('}') |
| 1137 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1138 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1139 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1140 | match = match_v1 |