pyof.v0x04.controller2switch.role_request   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 34
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A RoleRequest.__init__() 0 11 1
1
"""Request a change of the role of the controller."""
2
3
# System imports
4
5
# Third-party imports
6
7
# Local source tree imports
8 1
from pyof.v0x04.common.header import Type
9 1
from pyof.v0x04.controller2switch.common import RoleBaseMessage
10
11 1
__all__ = ('RoleRequest',)
12
13
# Classes
14
15
16 1
class RoleRequest(RoleBaseMessage):
17
    """RoleRequest Message.
18
19
    When the controller wants to change its role, it uses the OFPT_ROLE_REQUEST
20
    message.
21
    """
22
23 1
    def __init__(self, xid=None, role=None, generation_id=None):
24
        """Create a RoleRequest with the optional parameters below.
25
26
        Args:
27
            xid (int): OpenFlow xid to the header.
28
            role (:class:`~.controller2switch.common.ControllerRole`):
29
                Is the new role that the controller wants to assume.
30
            generation_id (int): Master Election Generation Id.
31
        """
32 1
        super().__init__(xid, role, generation_id)
33
        self.header.message_type = Type.OFPT_ROLE_REQUEST
34