x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.

Code Duplication    Length = 37-48 lines in 2 locations

pyof/v0x04/controller2switch/multipart_request.py 1 location

@@ 156-203 (lines=48) @@
153
        return BinaryData(b'')
154
155
156
class AggregateStatsRequest(GenericStruct):
157
    """Body for ofp_stats_request of type OFPST_AGGREGATE."""
158
159
    #: ID of table to read (from ofp_table_stats) OFPTT_ALL for all tables.
160
    table_id = UBInt8()
161
    #: Align to 32 bits.
162
    pad = Pad(3)
163
    #: Require matching entries to include this as an output port. A value of
164
    #: OFPP_ANY indicates no restriction.
165
    out_port = UBInt32()
166
    #: Require matching entries to include this as an output group. A value of
167
    #: OFPG_ANY indicates no restriction.
168
    out_group = UBInt32()
169
    #: Align to 64 bits
170
    pad2 = Pad(4)
171
    #: Require matching entries to contain this cookie value
172
    cookie = UBInt64()
173
    #: Mask used to restrict the cookie bits that must match. A value of 0
174
    #: indicates no restriction.
175
    cookie_mask = UBInt64()
176
    #: Fields to match. Variable size.
177
    match = Match()
178
179
    def __init__(self, table_id=Table.OFPTT_ALL, out_port=PortNo.OFPP_ANY,
180
                 out_group=Group.OFPG_ANY, cookie=0, cookie_mask=0,
181
                 match=None):
182
        """Create a AggregateStatsRequest with the optional parameters below.
183
184
        Args:
185
            table_id (int): ID of table to read (from ofp_table_stats)
186
                OFPTT_ALL for all tables.
187
            out_port (int): Require matching entries to include this as an
188
                output port. A value of OFPP_ANY indicates no restriction.
189
            out_group (int): Require matching entries to include this as an
190
                output group. A value of OFPG_ANY indicates no restriction.
191
            cookie (int): Require matching entries to contain this cookie value
192
            cookie_mask (int): Mask used to restrict the cookie bits that must
193
                match. A value of 0 indicates no restriction.
194
            match (~pyof.v0x04.common.flow_match.Match):
195
                Fields to match. Variable size
196
        """
197
        super().__init__()
198
        self.table_id = table_id
199
        self.out_port = out_port
200
        self.out_group = out_group
201
        self.cookie = cookie
202
        self.cookie_mask = cookie_mask
203
        self.match = Match() if match is None else match
204
205
206
class FlowStatsRequest(GenericStruct):

pyof/v0x01/controller2switch/common.py 1 location

@@ 408-444 (lines=37) @@
405
        self.queue_id = queue_id
406
407
408
class TableStats(GenericStruct):
409
    """Body of reply to OFPST_TABLE request."""
410
411
    table_id = UBInt8()
412
    #: Align to 32-bits.
413
    pad = Pad(3)
414
    name = Char(length=OFP_MAX_TABLE_NAME_LEN)
415
    wildcards = UBInt32(enum_ref=FlowWildCards)
416
    max_entries = UBInt32()
417
    active_count = UBInt32()
418
    count_lookup = UBInt64()
419
    count_matched = UBInt64()
420
421
    def __init__(self, table_id=None, name=None, wildcards=None,
422
                 max_entries=None, active_count=None, count_lookup=None,
423
                 count_matched=None):
424
        """Create a TableStats with the optional parameters below.
425
426
        Args:
427
            table_id (int): Identifier of table.  Lower numbered tables are
428
                consulted first.
429
            name (str): Table name.
430
            wildcards (:class:`~pyof.v0x01.common.flow_match.FlowWildCards`):
431
                Bitmap of OFPFW_* wildcards that are supported by the table.
432
            max_entries (int): Max number of entries supported.
433
            active_count (int): Number of active entries.
434
            count_lookup (int): Number of packets looked up in table.
435
            count_matched (int): Number of packets that hit table.
436
        """
437
        super().__init__()
438
        self.table_id = table_id
439
        self.name = name
440
        self.wildcards = wildcards
441
        self.max_entries = max_entries
442
        self.active_count = active_count
443
        self.count_lookup = count_lookup
444
        self.count_matched = count_matched
445
446
447
class VendorStats(GenericStruct):