Passed
Pull Request — master (#377)
by Diego Rabatone
02:41
created

SetAsync   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
dl 0
loc 37
ccs 4
cts 4
cp 1
c 1
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __init__() 0 30 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