| @@ 291-337 (lines=47) @@ | ||
| 288 | self.packet_count = packet_count |
|
| 289 | self.byte_count = byte_count |
|
| 290 | ||
| 291 | ||
| 292 | class PortStats(GenericStruct): |
|
| 293 | """Body of reply to OFPST_PORT request. |
|
| 294 | ||
| 295 | If a counter is unsupported, set the field to all ones. |
|
| 296 | """ |
|
| 297 | ||
| 298 | port_no = UBInt32() |
|
| 299 | #: Align to 64-bits. |
|
| 300 | pad = Pad(4) |
|
| 301 | rx_packets = UBInt64() |
|
| 302 | tx_packets = UBInt64() |
|
| 303 | rx_bytes = UBInt64() |
|
| 304 | tx_bytes = UBInt64() |
|
| 305 | rx_dropped = UBInt64() |
|
| 306 | tx_dropped = UBInt64() |
|
| 307 | rx_errors = UBInt64() |
|
| 308 | tx_errors = UBInt64() |
|
| 309 | rx_frame_err = UBInt64() |
|
| 310 | rx_over_err = UBInt64() |
|
| 311 | rx_crc_err = UBInt64() |
|
| 312 | collisions = UBInt64() |
|
| 313 | duration_sec = UBInt32() |
|
| 314 | duration_nsec = UBInt32() |
|
| 315 | ||
| 316 | # Can't avoid "too many local variables" (R0914) in this struct. |
|
| 317 | # pylint: disable=R0914 |
|
| 318 | def __init__(self, port_no=None, rx_packets=None, |
|
| 319 | tx_packets=None, rx_bytes=None, tx_bytes=None, |
|
| 320 | rx_dropped=None, tx_dropped=None, rx_errors=None, |
|
| 321 | tx_errors=None, rx_frame_err=None, rx_over_err=None, |
|
| 322 | rx_crc_err=None, collisions=None, duration_sec=None, |
|
| 323 | duration_nsec=None): |
|
| 324 | """The constructor assigns parameters to object attributes. |
|
| 325 | ||
| 326 | Args: |
|
| 327 | port_no (:class:`int`, :class:`~pyof.v0x04.common.port.Port`): |
|
| 328 | Port number. |
|
| 329 | rx_packets (int): Number of received packets. |
|
| 330 | tx_packets (int): Number of transmitted packets. |
|
| 331 | rx_bytes (int): Number of received bytes. |
|
| 332 | tx_bytes (int): Number of transmitted bytes. |
|
| 333 | rx_dropped (int): Number of packets dropped by RX. |
|
| 334 | tx_dropped (int): Number of packets dropped by TX. |
|
| 335 | rx_errors (int): Number of receive errors. This is a super-set of |
|
| 336 | more specific receive errors and should be greater than or |
|
| 337 | equal to the sum of all rx_*_err values. |
|
| 338 | tx_errors (int): Number of transmit errors. This is a super-set of |
|
| 339 | more specific transmit errors and should be greater than or |
|
| 340 | equal to the sum of all tx_*_err values (none currently |
|
| @@ 289-329 (lines=41) @@ | ||
| 286 | rx_frame_err = UBInt64() |
|
| 287 | rx_over_err = UBInt64() |
|
| 288 | rx_crc_err = UBInt64() |
|
| 289 | collisions = UBInt64() |
|
| 290 | ||
| 291 | def __init__(self, port_no=None, rx_packets=None, |
|
| 292 | tx_packets=None, rx_bytes=None, tx_bytes=None, |
|
| 293 | rx_dropped=None, tx_dropped=None, rx_errors=None, |
|
| 294 | tx_errors=None, rx_frame_err=None, rx_over_err=None, |
|
| 295 | rx_crc_err=None, collisions=None): |
|
| 296 | """The constructor assigns parameters to object attributes. |
|
| 297 | ||
| 298 | Args: |
|
| 299 | port_no (:class:`int`, :class:`~pyof.v0x01.common.phy_port.Port`): |
|
| 300 | Port number. |
|
| 301 | rx_packets (int): Number of received packets. |
|
| 302 | tx_packets (int): Number of transmitted packets. |
|
| 303 | rx_bytes (int): Number of received bytes. |
|
| 304 | tx_bytes (int): Number of transmitted bytes. |
|
| 305 | rx_dropped (int): Number of packets dropped by RX. |
|
| 306 | tx_dropped (int): Number of packets dropped by TX. |
|
| 307 | rx_errors (int): Number of receive errors. This is a super-set of |
|
| 308 | more specific receive errors and should be greater than or |
|
| 309 | equal to the sum of all rx_*_err values. |
|
| 310 | tx_errors (int): Number of transmit errors. This is a super-set of |
|
| 311 | more specific transmit errors and should be greater than or |
|
| 312 | equal to the sum of all tx_*_err values (none currently |
|
| 313 | defined). |
|
| 314 | rx_frame_err (int): Number of frame alignment errors. |
|
| 315 | rx_over_err (int): Number of packets with RX overrun. |
|
| 316 | rx_crc_err (int): Number of CRC errors. |
|
| 317 | collisions (int): Number of collisions. |
|
| 318 | """ |
|
| 319 | super().__init__() |
|
| 320 | self.port_no = port_no |
|
| 321 | self.rx_packets = rx_packets |
|
| 322 | self.tx_packets = tx_packets |
|
| 323 | self.rx_bytes = rx_bytes |
|
| 324 | self.tx_bytes = tx_bytes |
|
| 325 | self.rx_dropped = rx_dropped |
|
| 326 | self.tx_dropped = tx_dropped |
|
| 327 | self.rx_errors = rx_errors |
|
| 328 | self.tx_errors = tx_errors |
|
| 329 | self.rx_frame_err = rx_frame_err |
|
| 330 | self.rx_over_err = rx_over_err |
|
| 331 | self.rx_crc_err = rx_crc_err |
|
| 332 | self.collisions = collisions |
|