Passed
Push — master ( b50e97...feedcb )
by Humberto
01:28 queued 14s
created

tests.unit.v0x01.test_common.test_flow_match   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 31
dl 0
loc 46
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A TestMatch.test_unpack() 0 4 1
A TestMatch.setUp() 0 15 1
A TestMatch.test_get_size() 0 3 1
A TestMatch.test_pack_unpack() 0 6 1
A TestMatch.test_pack() 0 4 1
1
"""Testing FlowMatch structure."""
2
import unittest
3
4
from pyof.v0x01.common import flow_match
5
6
7
class TestMatch(unittest.TestCase):
8
    """Test Match structure."""
9
10
    def setUp(self):
11
        """Basic setup for test."""
12
        self.message = flow_match.Match()
13
        self.message.in_port = 22
14
        self.message.dl_src = [1, 2, 3, 4, 5, 6]
15
        self.message.dl_dst = [1, 2, 3, 4, 5, 6]
16
        self.message.dl_vlan = 1
17
        self.message.dl_vlan_pcp = 1
18
        self.message.dl_type = 1
19
        self.message.nw_tos = 1
20
        self.message.nw_proto = 1
21
        self.message.nw_src = [192, 168, 0, 1]
22
        self.message.nw_dst = [192, 168, 0, 2]
23
        self.message.tp_src = 22
24
        self.message.tp_dst = 22
25
26
    def test_get_size(self):
27
        """[Common/FlowMatch] - size 40."""
28
        self.assertEqual(self.message.get_size(), 40)
29
30
    def test_pack_unpack(self):
31
        """[Common/FlowMatch] - packing and unpacking."""
32
        pack = self.message.pack()
33
        unpacked = flow_match.Match()
34
        unpacked.unpack(pack)
35
        self.assertEqual(self.message.pack(), unpacked.pack())
36
37
    @unittest.skip('Not yet implemented')
38
    def test_pack(self):
39
        """[Common/FlowMatch] - packing."""
40
        pass
41
42
    @unittest.skip('Not yet implemented')
43
    def test_unpack(self):
44
        """[Common/FlowMatch] - unpacking."""
45
        pass
46