Passed
Pull Request — master (#404)
by
unknown
01:47
created

TestActionVlanPCP.setUpClass()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
1
"""Testing Port structures."""
2
from pyof.v0x01.common.action import (
3
    ActionDLAddr, ActionEnqueue, ActionNWAddr, ActionNWTos, ActionOutput,
4
    ActionTPPort, ActionType, ActionVendorHeader, ActionVlanPCP, ActionVlanVid)
5
from pyof.v0x01.common.phy_port import Port
6
from tests.test_struct import TestMsgDumpFile
7
8
9
class TestActionOutput(TestMsgDumpFile):
10
    """ActionOutput message tests (also those in :class:`.TestDump`)."""
11
12
    dumpfile = 'v0x01/ofpt_action_output.dat'
13
    obj = ActionOutput(port=Port.OFPP_CONTROLLER,
14
                       max_length=8)
15
    min_size = 8
16
17
18
class TestActionEnqueue(TestMsgDumpFile):
19
    """ActionEnqueue message tests (also those in :class:`.TestDump`)."""
20
21
    dumpfile = 'v0x01/ofpt_action_enqueue.dat'
22
    obj = ActionEnqueue(port=Port.OFPP_CONTROLLER,
23
                        queue_id=4)
24
    min_size = 16
25
26
27
class TestActionVlanVid(TestMsgDumpFile):
28
    """ActionVlanVid message tests (also those in :class:`.TestDump`)."""
29
30
    dumpfile = 'v0x01/ofpt_action_vlan_vid.dat'
31
    obj = ActionVlanVid(vlan_id=5)
32
    min_size = 8
33
34
35
class TestActionVlanPCP(TestMsgDumpFile):
36
    """ActionVlanPCP message tests (also those in :class:`.TestDump`)."""
37
38
    dumpfile = 'v0x01/ofpt_action_vlan_pcp.dat'
39
    obj = ActionVlanPCP(vlan_pcp=2)
40
    min_size = 8
41
42
43
class TestActionDLAddr(TestMsgDumpFile):
44
    """ActionDLAddr message tests (also those in :class:`.TestDump`)."""
45
46
    dumpfile = 'v0x01/ofpt_action_dl_addr.dat'
47
    obj = ActionDLAddr(action_type=ActionType.OFPAT_SET_DL_SRC,
48
                       dl_addr=[12, 12, 12, 12, 12, 12])
49
    min_size = 16
50
51
52
class TestActionNWAddr(TestMsgDumpFile):
53
    """ActionNWAddr message tests (also those in :class:`.TestDump`)."""
54
55
    dumpfile = 'v0x01/ofpt_action_nw_addr.dat'
56
    obj = ActionNWAddr(action_type=ActionType.OFPAT_SET_NW_SRC,
57
                       nw_addr=[12, 12, 12, 12, 12, 12])
58
    min_size = 8
59
60
61
class TestActionNWTos(TestMsgDumpFile):
62
    """ActionNWTos message tests (also those in :class:`.TestDump`)."""
63
64
    dumpfile = 'v0x01/ofpt_action_nw_tos.dat'
65
    obj = ActionNWTos(action_type=ActionType.OFPAT_SET_NW_SRC,
66
                      nw_tos=123456)
67
    min_size = 8
68
69
70
class TestActionTPPort(TestMsgDumpFile):
71
    """ActionTPPort message tests (also those in :class:`.TestDump`)."""
72
73
    dumpfile = 'v0x01/ofpt_action_tp_port.dat'
74
    obj = ActionTPPort(action_type=ActionType.OFPAT_SET_TP_SRC,
75
                       tp_port=8888)
76
    min_size = 8
77
78
79
class TestActionVendorHeader(TestMsgDumpFile):
80
    """ActionVendorHeader message tests (also those in :class:`.TestDump`)."""
81
82
    dumpfile = 'v0x01/ofpt_action_vendor_header.dat'
83
    obj = ActionVendorHeader(length=16, vendor=1)
84
    min_size = 8
85