Test Failed
Pull Request — master (#404)
by
unknown
01:46
created

TestIPV4.test_IPv4_checksum()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
1
"""Test Python-openflow network types."""
2
from pyof.foundation.basic_types import BinaryData
3
from pyof.foundation.network_types import GenericTLV, IPv4
4
from tests.test_struct import TestStructDump
5
6
7
class TestGenericTLV(TestStructDump):
8
    """Test the GenericTLV value data."""
9
10
    dump = b'\xfe\x04test'
11
    obj = GenericTLV(value=BinaryData(b'test'))
12
13
14
class TestIPV4(TestStructDump):
15
    """Test the IPV4 class."""
16
17
    dump = b'F(\x00 \x00\x00\x00\x00@\x11\x02' +\
18
        b'\xc5\xc0\xa8\x00\n\xac\x10\n\x1e1000testdata'
19
    obj = IPv4(dscp=10, ttl=64, protocol=17, source="192.168.0.10",
20
               destination="172.16.10.30", options=b'1000',
21
               data=b'testdata')
22
23
    def test_IPv4_checksum(self):
24
        """Test if the IPv4 checksum is being calculated correclty."""
25
        self.assertEqual(self._unpacked_dump.checksum, 709)
26