Code Duplication    Length = 30-35 lines in 2 locations

pyof/v0x04/controller2switch/multipart_reply.py 1 location

@@ 173-207 (lines=35) @@
170
171
172
# MultipartReply Body
173
174
class AggregateStatsReply(GenericStruct):
175
    """Body of reply to OFPMP_AGGREGATE request."""
176
177
    #: Number of packets in flows.
178
    packet_count = UBInt64()
179
    #: Number of bytes in flows.
180
    byte_count = UBInt64()
181
    #: Number of flows.
182
    flow_count = UBInt32()
183
    #: Align to 64 bits
184
    pad = Pad(4)
185
186
    def __init__(self, packet_count=None, byte_count=None, flow_count=None):
187
        """The constructor just assings parameters to object attributes.
188
189
        Args:
190
            packet_count (int): Number of packets in flows
191
            byte_count (int):   Number of bytes in flows
192
            flow_count (int):   Number of flows
193
        """
194
        super().__init__()
195
        self.packet_count = packet_count
196
        self.byte_count = byte_count
197
        self.flow_count = flow_count
198
199
200
class Desc(GenericStruct):
201
    """Information available from the OFPST_DESC stats request.
202
203
    Information about the switch manufacturer, hardware revision, software
204
    revision, serial number and a description field.
205
    """
206
207
    #: Manufacturer description
208
    mfr_desc = Char(length=DESC_STR_LEN)
209
    #: Hardware description
210
    hw_desc = Char(length=DESC_STR_LEN)

pyof/v0x01/controller2switch/common.py 1 location

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