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

tests.unit.v0x01.test_controller2switch.test_flow_stats_request   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 23
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestFlowStatsRequest.setUpClass() 0 9 1

2 Functions

Rating   Name   Duplication   Size   Complexity  
A _get_match() 0 8 1
A _get_flow_stats_request() 0 2 1
1
"""Test FlowStatsRequest message."""
2
from pyof.v0x01.common.flow_match import Match
3
from pyof.v0x01.controller2switch.common import FlowStatsRequest, StatsType
4
from pyof.v0x01.controller2switch.stats_request import StatsRequest
5
from tests.unit.test_struct import TestStruct
6
7
8
class TestFlowStatsRequest(TestStruct):
9
    """Test class for TestFlowStatsRequest."""
10
11
    @classmethod
12
    def setUpClass(cls):
13
        """[Controller2Switch/FlowStatsRequest] - size 44."""
14
        super().setUpClass()
15
        super().set_raw_dump_file('v0x01', 'ofpt_flow_stats_request')
16
        super().set_raw_dump_object(StatsRequest, xid=12,
17
                                    body_type=StatsType.OFPST_FLOW,
18
                                    flags=0, body=_get_flow_stats_request())
19
        super().set_minimum_size(12)
20
21
22
def _get_flow_stats_request():
23
    return FlowStatsRequest(match=_get_match(), table_id=1, out_port=80)
24
25
26
def _get_match():
27
    """Function used to return a Match instance."""
28
    return Match(in_port=80, dl_src='01:02:03:04:05:06',
29
                 dl_dst='01:02:03:04:05:06', dl_vlan=1,
30
                 dl_vlan_pcp=1, dl_type=1,
31
                 nw_tos=1, nw_proto=1,
32
                 nw_src='192.168.0.1', nw_dst='192.168.0.1',
33
                 tp_src=80, tp_dst=80)
34