Code Duplication    Length = 33-35 lines in 2 locations

pyof/v0x01/controller2switch/common.py 1 location

@@ 189-223 (lines=35) @@
186
    packet_count = UBInt64()
187
    byte_count = UBInt64()
188
    actions = ListOfActions()
189
190
    def __init__(self, length=None, table_id=None, match=None,
191
                 duration_sec=None, duration_nsec=None, priority=None,
192
                 idle_timeout=None, hard_timeout=None, cookie=None,
193
                 packet_count=None, byte_count=None, actions=None):
194
        """The constructor just assigns parameters to object attributes.
195
196
        Args:
197
            length (int): Length of this entry.
198
            table_id (int): ID of table flow came from.
199
            match (~pyof.v0x01.common.flow_match.Match): Description of fields.
200
            duration_sec (int): Time flow has been alive in seconds.
201
            duration_nsec (int): Time flow has been alive in nanoseconds in
202
                addition to duration_sec.
203
            priority (int): Priority of the entry. Only meaningful when this
204
                is not an exact-match entry.
205
            idle_timeout (int): Number of seconds idle before expiration.
206
            hard_timeout (int): Number of seconds before expiration.
207
            cookie (int): Opaque controller-issued identifier.
208
            packet_count (int): Number of packets in flow.
209
            byte_count (int): Number of bytes in flow.
210
            actions (:class:`~pyof.v0x01.common.actions.ListOfActions`):
211
                List of Actions.
212
        """
213
        super().__init__()
214
        self.length = length
215
        self.table_id = table_id
216
        self.match = match
217
        self.duration_sec = duration_sec
218
        self.duration_nsec = duration_nsec
219
        self.priority = priority
220
        self.idle_timeout = idle_timeout
221
        self.hard_timeout = hard_timeout
222
        self.cookie = cookie
223
        self.packet_count = packet_count
224
        self.byte_count = byte_count
225
        self.actions = [] if actions is None else actions
226

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 257-289 (lines=33) @@
254
    byte_count = UBInt64()
255
    match = Match()
256
257
    def __init__(self, length=None, table_id=None, duration_sec=None,
258
                 duration_nsec=None, priority=None, idle_timeout=None,
259
                 hard_timeout=None, flags=None, cookie=None, packet_count=None,
260
                 byte_count=None, match=None):
261
        """The constructor just assigns parameters to object attributes.
262
263
        Args:
264
            length (int): Length of this entry.
265
            table_id (int): ID of table flow came from.
266
            duration_sec (int): Time flow has been alive in seconds.
267
            duration_nsec (int): Time flow has been alive in nanoseconds in
268
                addition to duration_sec.
269
            priority (int): Priority of the entry. Only meaningful when this
270
                is not an exact-match entry.
271
            idle_timeout (int): Number of seconds idle before expiration.
272
            hard_timeout (int): Number of seconds before expiration.
273
            cookie (int): Opaque controller-issued identifier.
274
            packet_count (int): Number of packets in flow.
275
            byte_count (int): Number of bytes in flow.
276
            match (~pyof.v0x04.common.flow_match.Match): Description of fields.
277
        """
278
        super().__init__()
279
        self.length = length
280
        self.table_id = table_id
281
        self.duration_sec = duration_sec
282
        self.duration_nsec = duration_nsec
283
        self.priority = priority
284
        self.idle_timeout = idle_timeout
285
        self.hard_timeout = hard_timeout
286
        self.flags = flags
287
        self.cookie = cookie
288
        self.packet_count = packet_count
289
        self.byte_count = byte_count
290
291
292
class PortStats(GenericStruct):