File: test_flow_instruction.py

package info (click to toggle)
python-openflow 1.1.0~alpha2-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 692 kB
  • ctags: 1,027
  • sloc: python: 2,713; makefile: 207; sh: 8
file content (54 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import unittest

from pyof.v0x02.common import flow_instruction


class TestOFPInstructionGoToTable(unittest.TestCase):
    def test_get_size(self):
        message = flow_instruction.OFPInstructionGoToTable(
                type=flow_instruction.OFPInstructionsType.OFPIT_GOTO_TABLE,
                len=8, table_id=1, pad=[0, 0, 0])
        self.assertEqual(message.get_size(), 8)

    def test_pack(self):
        message = flow_instruction.OFPInstructionGoToTable(
                type=flow_instruction.OFPInstructionsType.OFPIT_GOTO_TABLE,
                len=8, table_id=1, pad=[0, 0, 0])
        message.pack()

    def test_unpack(self):
        pass


class TestOFPInstructionWriteMetadata(unittest.TestCase):
    def test_get_size(self):
        message = flow_instruction.OFPInstructionWriteMetadata(
                type=flow_instruction.OFPInstructionsType.OFPIT_WRITE_METADATA,
                len=24, pad=[0, 0, 0, 0], metadata=1, metadata_mask=1)
        self.assertEqual(message.get_size(), 24)

    def test_pack(self):
        message = flow_instruction.OFPInstructionWriteMetadata(
                type=flow_instruction.OFPInstructionsType.OFPIT_WRITE_METADATA,
                len=24, pad=[0, 0, 0, 0], metadata=1, metadata_mask=1)
        message.pack()

    def test_unpack(self):
        pass


class TestOFPInstructionActions(unittest.TestCase):
    def test_get_size(self):
        message = flow_instruction.OFPInstructionActions(
            type=flow_instruction.OFPInstructionsType.OFPIT_WRITE_ACTIONS,
            len=8)
        self.assertEqual(message.get_size(), 8)

    def test_pack(self):
        message = flow_instruction.OFPInstructionActions(
            type=flow_instruction.OFPInstructionsType.OFPIT_WRITE_ACTIONS,
            len=8)
        message.pack()

    def test_unpack(self):
        pass