Code Duplication    Length = 30-35 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 200-234 (lines=35) @@
197
        self.packet_count = packet_count
198
        self.byte_count = byte_count
199
        self.flow_count = flow_count
200
201
202
class Desc(GenericStruct):
203
    """Information available from the OFPST_DESC stats request.
204
205
    Information about the switch manufacturer, hardware revision, software
206
    revision, serial number and a description field.
207
    """
208
209
    #: Manufacturer description
210
    mfr_desc = Char(length=DESC_STR_LEN)
211
    #: Hardware description
212
    hw_desc = Char(length=DESC_STR_LEN)
213
    #: Software description
214
    sw_desc = Char(length=DESC_STR_LEN)
215
    #: Serial number
216
    serial_num = Char(length=SERIAL_NUM_LEN)
217
    #: Datapath description
218
    dp_desc = Char(length=DESC_STR_LEN)
219
220
    def __init__(self, mfr_desc=None, hw_desc=None, sw_desc=None,
221
                 serial_num=None, dp_desc=None):
222
        """Create a Desc with the optional parameters below.
223
224
        Args:
225
            mfr_desc (str): Manufacturer description
226
            hw_desc (str): Hardware description
227
            sw_desc (str): Software description
228
            serial_num (str): Serial number
229
            dp_desc (str): Datapath description
230
        """
231
        super().__init__()
232
        self.mfr_desc = mfr_desc
233
        self.hw_desc = hw_desc
234
        self.sw_desc = sw_desc
235
        self.serial_num = serial_num
236
        self.dp_desc = dp_desc
237

pyof/v0x01/controller2switch/common.py 1 location

@@ 137-166 (lines=30) @@
134
        self.table_id = table_id
135
        self.out_port = out_port
136
137
138
class DescStats(GenericStruct):
139
    """Information available from the OFPST_DESC stats request.
140
141
    Information about the switch manufacturer, hardware revision, software
142
    revision, serial number and a description field.
143
    """
144
145
    mfr_desc = Char(length=DESC_STR_LEN)
146
    hw_desc = Char(length=DESC_STR_LEN)
147
    sw_desc = Char(length=DESC_STR_LEN)
148
    serial_num = Char(length=SERIAL_NUM_LEN)
149
    dp_desc = Char(length=DESC_STR_LEN)
150
151
    def __init__(self, mfr_desc=None, hw_desc=None, sw_desc=None,
152
                 serial_num=None, dp_desc=None):
153
        """Create a DescStats with the optional parameters below.
154
155
        Args:
156
            mfr_desc (str): Manufacturer description
157
            hw_desc (str): Hardware description
158
            sw_desc (str): Software description
159
            serial_num (str): Serial number
160
            dp_desc (str): Human readable description of datapath
161
        """
162
        super().__init__()
163
        self.mfr_desc = mfr_desc
164
        self.hw_desc = hw_desc
165
        self.sw_desc = sw_desc
166
        self.serial_num = serial_num
167
        self.dp_desc = dp_desc
168
169