Code Duplication    Length = 41-47 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 334-380 (lines=47) @@
331
    duration_sec = UBInt32()
332
    duration_nsec = UBInt32()
333
334
    def __init__(self, port_no=None, rx_packets=None,
335
                 tx_packets=None, rx_bytes=None, tx_bytes=None,
336
                 rx_dropped=None, tx_dropped=None, rx_errors=None,
337
                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
338
                 rx_crc_err=None, collisions=None, duration_sec=None,
339
                 duration_nsec=None):
340
        """Create a PortStats with the optional parameters below.
341
342
        Args:
343
            port_no (:class:`int`, :class:`~pyof.v0x04.common.port.Port`):
344
                Port number.
345
            rx_packets (int): Number of received packets.
346
            tx_packets (int): Number of transmitted packets.
347
            rx_bytes (int): Number of received bytes.
348
            tx_bytes (int): Number of transmitted bytes.
349
            rx_dropped (int): Number of packets dropped by RX.
350
            tx_dropped (int): Number of packets dropped by TX.
351
            rx_errors (int): Number of receive errors. This is a super-set of
352
                more specific receive errors and should be greater than or
353
                equal to the sum of all rx_*_err values.
354
            tx_errors (int): Number of transmit errors.  This is a super-set of
355
                more specific transmit errors and should be greater than or
356
                equal to the sum of all tx_*_err values (none currently
357
                defined).
358
            rx_frame_err (int): Number of frame alignment errors.
359
            rx_over_err (int): Number of packets with RX overrun.
360
            rx_crc_err (int): Number of CRC errors.
361
            collisions (int): Number of collisions.
362
            duration_sec (int): Time port has been alive in seconds
363
            duration_nsec (int): Time port has been alive in nanoseconds beyond
364
                duration_sec
365
        """
366
        super().__init__()
367
        self.port_no = port_no
368
        self.rx_packets = rx_packets
369
        self.tx_packets = tx_packets
370
        self.rx_bytes = rx_bytes
371
        self.tx_bytes = tx_bytes
372
        self.rx_dropped = rx_dropped
373
        self.tx_dropped = tx_dropped
374
        self.rx_errors = rx_errors
375
        self.tx_errors = tx_errors
376
        self.rx_frame_err = rx_frame_err
377
        self.rx_over_err = rx_over_err
378
        self.rx_crc_err = rx_crc_err
379
        self.collisions = collisions
380
        self.duration_sec = duration_sec
381
        self.duration_nsec = duration_nsec
382
383

pyof/v0x01/controller2switch/common.py 1 location

@@ 292-332 (lines=41) @@
289
    rx_crc_err = UBInt64()
290
    collisions = UBInt64()
291
292
    def __init__(self, port_no=None, rx_packets=None,
293
                 tx_packets=None, rx_bytes=None, tx_bytes=None,
294
                 rx_dropped=None, tx_dropped=None, rx_errors=None,
295
                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
296
                 rx_crc_err=None, collisions=None):
297
        """Create a PortStats with the optional parameters below.
298
299
        Args:
300
            port_no (:class:`int`, :class:`~pyof.v0x01.common.phy_port.Port`):
301
                Port number.
302
            rx_packets (int): Number of received packets.
303
            tx_packets (int): Number of transmitted packets.
304
            rx_bytes (int): Number of received bytes.
305
            tx_bytes (int): Number of transmitted bytes.
306
            rx_dropped (int): Number of packets dropped by RX.
307
            tx_dropped (int): Number of packets dropped by TX.
308
            rx_errors (int): Number of receive errors. This is a super-set of
309
                more specific receive errors and should be greater than or
310
                equal to the sum of all rx_*_err values.
311
            tx_errors (int): Number of transmit errors.  This is a super-set of
312
                more specific transmit errors and should be greater than or
313
                equal to the sum of all tx_*_err values (none currently
314
                defined).
315
            rx_frame_err (int): Number of frame alignment errors.
316
            rx_over_err (int): Number of packets with RX overrun.
317
            rx_crc_err (int): Number of CRC errors.
318
            collisions (int): Number of collisions.
319
        """
320
        super().__init__()
321
        self.port_no = port_no
322
        self.rx_packets = rx_packets
323
        self.tx_packets = tx_packets
324
        self.rx_bytes = rx_bytes
325
        self.tx_bytes = tx_bytes
326
        self.rx_dropped = rx_dropped
327
        self.tx_dropped = tx_dropped
328
        self.rx_errors = rx_errors
329
        self.tx_errors = tx_errors
330
        self.rx_frame_err = rx_frame_err
331
        self.rx_over_err = rx_over_err
332
        self.rx_crc_err = rx_crc_err
333
        self.collisions = collisions
334
335