Code Duplication    Length = 30-35 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 202-236 (lines=35) @@
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
238
239
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):