| Total Complexity | 1 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 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 |