|
1 | 1 | """FlowMod test."""
|
2 |
| -from pyof.v0x04.common.flow_instructions import InstructionApplyAction, InstructionType, ListOfInstruction |
| 2 | +from pyof.v0x04.common.action import ActionOutput, ListOfActions |
| 3 | +from pyof.v0x04.common.flow_instructions import ( |
| 4 | + InstructionApplyAction, ListOfInstruction) |
3 | 5 | from pyof.v0x04.common.flow_match import (
|
4 | 6 | Match, MatchType, OxmClass, OxmOfbMatchField, OxmTLV)
|
5 |
| -from pyof.v0x04.controller2switch.flow_mod import FlowMod, FlowModCommand |
6 |
| -from pyof.v0x04.common.action import ActionOutput, ListOfActions |
7 | 7 | from pyof.v0x04.common.port import PortNo
|
| 8 | +from pyof.v0x04.controller2switch.flow_mod import FlowMod, FlowModCommand |
8 | 9 | from tests.test_struct import TestStruct
|
9 | 10 |
|
| 11 | + |
10 | 12 | class TestFlowMod(TestStruct):
|
11 | 13 | """FlowMod test."""
|
12 | 14 |
|
13 | 15 | def test_min_size(self):
|
14 | 16 | """Test struct minimum size."""
|
15 | 17 | super().set_raw_dump_file('v0x04', 'ofpt_flow_mod')
|
16 | 18 | super().set_raw_dump_object(FlowMod, xid=2219910763,
|
17 |
| - command=FlowModCommand.OFPFC_ADD, |
18 |
| - priority = 1000, |
19 |
| - match = _new_match(), |
20 |
| - instructions = _new_list_of_instructions()) |
| 19 | + command=FlowModCommand.OFPFC_ADD, |
| 20 | + priority=1000, |
| 21 | + match=_new_match(), |
| 22 | + instructions=_new_list_of_instructions()) |
21 | 23 | super().set_minimum_size(56)
|
22 | 24 |
|
23 | 25 |
|
24 | 26 | def _new_match():
|
25 | 27 | """Crate new Match instance."""
|
26 |
| - oxmtlv1 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC, |
27 |
| - oxm_field=OxmOfbMatchField.OFPXMT_OFB_ETH_TYPE, |
28 |
| - oxm_hasmask=False, oxm_value=b'\x88\xcc') |
29 |
| - oxmtlv2 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC, |
30 |
| - oxm_field=OxmOfbMatchField.OFPXMT_OFB_VLAN_VID, |
31 |
| - oxm_hasmask=False, oxm_value=b'\x1e\xd7') |
| 28 | + oxm_tlv1 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC, |
| 29 | + oxm_field=OxmOfbMatchField.OFPXMT_OFB_ETH_TYPE, |
| 30 | + oxm_hasmask=False, oxm_value=b'\x88\xcc') |
| 31 | + oxmt_lv2 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC, |
| 32 | + oxm_field=OxmOfbMatchField.OFPXMT_OFB_VLAN_VID, |
| 33 | + oxm_hasmask=False, oxm_value=b'\x1e\xd7') |
32 | 34 | return Match(match_type=MatchType.OFPMT_OXM,
|
33 |
| - oxm_match_fields=[oxmtlv1, oxmtlv2]) |
| 35 | + oxm_match_fields=[oxm_tlv1, oxmt_lv2]) |
34 | 36 |
|
35 | 37 | def _new_list_of_instructions():
|
36 | 38 | """Crate new ListOfInstruction."""
|
37 |
| - ao = ActionOutput(port=PortNo.OFPP_CONTROLLER) |
38 |
| - loa = ListOfActions([ao]) |
| 39 | + output = ActionOutput(port=PortNo.OFPP_CONTROLLER) |
| 40 | + loa = ListOfActions([output]) |
39 | 41 | instruction = InstructionApplyAction(loa)
|
40 | 42 | return ListOfInstruction([instruction])
|
0 commit comments