Test Failed
Push — master ( 182015...f7f025 )
by Carlos Eduardo
01:35
created

TestTableFeatures   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
dl 0
loc 12
c 3
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestMultipartReply.setUpClass() 0 9 1
1
"""MultipartReply message test."""
2
3
from pyof.v0x04.controller2switch.common import MultipartTypes
4
from pyof.v0x04.controller2switch.multipart_reply import (Desc, MultipartReply,
5
                                                          MultipartReplyFlags)
6
from tests.v0x04.test_struct import TestStruct
7
8
9
class TestMultipartReply(TestStruct):
10
    """Test MultipartReply."""
11
12
    @classmethod
13
    def setUpClass(cls):
14
        """Configure raw file and its object in parent class (TestDump)."""
15
        super().setUpClass()
16
        super().set_message(MultipartReply, xid=16,
17
                            multipart_type=MultipartTypes.OFPMP_METER_CONFIG,
18
                            flags=MultipartReplyFlags.OFPMPF_REPLY_MORE,
19
                            body='')
20
        super().set_minimum_size(16)
21
22
    @staticmethod
23
    def get_attributes(multipart_type=MultipartTypes.OFPMP_DESC,
24
                       flags=MultipartReplyFlags.OFPMPF_REPLY_MORE,
25
                       body=''):
26
        """Method used to return a dict with instance paramenters."""
27
        return {'xid': 32, 'multipart_type': multipart_type, 'flags': flags,
28
                'body': body}
29
30
    def test_pack_unpack_desc(self):
31
        """Testing multipart_type with OFPMP_DESC."""
32
        instances = Desc(mfr_desc="MANUFACTURER DESCRIPTION",
33
                         hw_desc="HARDWARE DESCRIPTION",
34
                         sw_desc="SOFTWARE DESCRIPTION",
35
                         serial_num="SERIAL NUMBER",
36
                         dp_desc="DATAPATH DESCRIPTION")
37
        options = TestMultipartReply.get_attributes(
38
            multipart_type=MultipartTypes.OFPMP_DESC, body=instances)
39
        self._test_pack_unpack(**options)
40