Code Duplication    Length = 30-36 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

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

pyof/v0x01/controller2switch/common.py 1 location

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