Code Duplication    Length = 33-35 lines in 2 locations

pyof/v0x01/controller2switch/common.py 1 location

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

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 assings 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):