Code Duplication    Length = 25-28 lines in 2 locations

pyof/v0x04/controller2switch/group_mod.py 1 location

@@ 65-92 (lines=28) @@
62
        super().__init__(pyof_class=Bucket, items=items)
63
64
65
class GroupMod(GenericMessage):
66
    """Group setup and teardown (controller -> datapath)."""
67
68
    header = Header(message_type=Type.OFPT_GROUP_MOD)
69
    command = UBInt16(enum_ref=GroupModCommand)
70
    group_type = UBInt8()
71
    #: Pad to 64 bits.
72
    pad = Pad(1)
73
    group_id = UBInt32()
74
    buckets = ListOfBuckets()
75
76
    def __init__(self, xid=None, command=None, group_type=None, group_id=None,
77
                 buckets=None):
78
        """Initialize all instance variables.
79
80
        Args:
81
            xid (int): Header's transaction id. Defaults to random.
82
            command (GroupModCommand): One of OFPGC_*.
83
            group_type (GroupType): One of OFPGT_*.
84
            group_id (int): Group identifier.
85
            buckets (:class:`ListOfBuckets`): The length of the bucket
86
                array is inferred from the length field in the header.
87
        """
88
        super().__init__(xid)
89
        self.command = command
90
        self.group_type = group_type
91
        self.group_id = group_id
92
        self.buckets = buckets
93

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 376-400 (lines=25) @@
373
    tx_packets = UBInt64()
374
    tx_errors = UBInt64()
375
    duration_sec = UBInt32()
376
    duration_nsec = UBInt32()
377
378
    def __init__(self, port_no=None, queue_id=None, tx_bytes=None,
379
                 tx_packets=None, tx_errors=None, duration_sec=None,
380
                 duration_nsec=None):
381
        """The constructor just assings parameters to object attributes.
382
383
        Args:
384
            port_no (:class:`int`, :class:`.Port`): Port Number.
385
            queue_id (int): Queue ID.
386
            tx_bytes (int): Number of transmitted bytes.
387
            tx_packets (int): Number of transmitted packets.
388
            tx_errors (int): Number of packets dropped due to overrun.
389
            duration_sec (int): Time queue has been alive in seconds.
390
            duration_nsec (int): Time queue has been alive in nanoseconds
391
                beyond duration_sec.
392
        """
393
        super().__init__()
394
        self.port_no = port_no
395
        self.queue_id = queue_id
396
        self.tx_bytes = tx_bytes
397
        self.tx_packets = tx_packets
398
        self.tx_errors = tx_errors
399
        self.duration_sec = duration_sec
400
        self.duration_nsec = duration_nsec
401
402
403
class GroupDescStats(GenericStruct):