tests.unit.v0x01.test_controller2switch.test_aggregate_stats_request   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 25
dl 0
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestAggregateStatsRequest.setUpClass() 0 12 1

1 Function

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