Passed
Pull Request — master (#370)
by macartur
02:27
created

SetAsync.__init__()   B

Complexity

Conditions 1

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 30
ccs 3
cts 3
cp 1
c 1
b 0
f 0
rs 8.8571
cc 1
crap 1
1
"""Define SetAsync message.
2
3
Sets whether a controller should receive a given asynchronous message that is
4
generated by the switch.
5
"""
6
7
# System imports
8
9
# Third-party imports
10
11
# Local imports
12 1
from pyof.v0x04.common.header import Type
13 1
from pyof.v0x04.controller2switch.common import AsyncConfig
14
15 1
__all__ = ('SetAsync',)
16
17
18 1
class SetAsync(AsyncConfig):
19
    """SetAsync message.
20
21
    Sets whether a controller should receive a given asynchronous message that
22
    is generated by the switch.
23
    """
24
25 1
    def __init__(self, xid=None, packet_in_mask1=None, packet_in_mask2=None,
26
                 port_status_mask1=None, port_status_mask2=None,
27
                 flow_removed_mask1=None, flow_removed_mask2=None):
28
        """Set attributes for SetAsync message.
29
30
        Args:
31
            xid (int): xid to be used on the message header.
32
            packet_in_mask1
33
                (~pyof.v0x04.asynchronous.packet_in.PacketInReason):
34
                    A instance of PacketInReason
35
            packet_in_mask2
36
                (~pyof.v0x04.asynchronous.packet_in.PacketInReason):
37
                    A instance of PacketInReason
38
            port_status_mask1
39 1
                (~pyof.v0x04.asynchronous.port_status.PortReason):
40
                    A instance of PortReason
41
            port_status_mask2
42 1
                (~pyof.v0x04.asynchronous.port_status.PortReason):
43
                    A instance of PortReason
44
            flow_removed_mask1
45
                (~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
46
                    A instance of FlowRemoved.
47
            flow_removed_mask2
48
                (~pyof.v0x04.asynchronous.flow_removed.FlowRemoved):
49
                    A instance of FlowRemoved.
50
        """
51
        super().__init__(xid, packet_in_mask1, packet_in_mask2,
52
                         port_status_mask1, port_status_mask2,
53
                         flow_removed_mask1, flow_removed_mask2)
54
        self.header.message_type = Type.OFPT_SET_ASYNC
55