|
1
|
|
|
"""Testing FlowRemoved message.""" |
|
2
|
|
|
from pyof.foundation.basic_types import HWAddress, IPAddress |
|
3
|
|
|
from pyof.v0x01.asynchronous.flow_removed import FlowRemoved, FlowRemovedReason |
|
4
|
|
|
from pyof.v0x01.common.flow_match import Match |
|
5
|
|
|
from tests.unit.test_struct import TestStruct |
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class TestFlowRemoved(TestStruct): |
|
9
|
|
|
"""Test the FlowRemoved message.""" |
|
10
|
|
|
|
|
11
|
|
|
@classmethod |
|
12
|
|
|
def setUpClass(cls): |
|
13
|
|
|
"""Setup TestStruct.""" |
|
14
|
|
|
reason = FlowRemovedReason.OFPRR_IDLE_TIMEOUT |
|
15
|
|
|
match = Match(in_port=80, dl_vlan=1, dl_vlan_pcp=1, dl_type=1, |
|
16
|
|
|
nw_tos=1, nw_proto=1, tp_src=80, tp_dst=80, |
|
17
|
|
|
dl_src=HWAddress('00:00:00:00:00:00'), |
|
18
|
|
|
dl_dst=HWAddress('00:00:00:00:00:00'), |
|
19
|
|
|
nw_src=IPAddress('192.168.0.1'), |
|
20
|
|
|
nw_dst=IPAddress('192.168.0.2')) |
|
21
|
|
|
|
|
22
|
|
|
super().setUpClass() |
|
23
|
|
|
super().set_raw_dump_file('v0x01', 'ofpt_flow_removed') |
|
24
|
|
|
super().set_raw_dump_object(FlowRemoved, xid=12, |
|
25
|
|
|
match=match, cookie=0, priority=1, |
|
26
|
|
|
reason=reason, duration_sec=4, |
|
27
|
|
|
duration_nsec=23, idle_timeout=9, |
|
28
|
|
|
packet_count=10, byte_count=4) |
|
29
|
|
|
super().set_minimum_size(88) |
|
30
|
|
|
|