2023-03-28 17:33:34 +01:00
|
|
|
# Crown Copyright (C) Dstl 2022. DEFCON 703. Shared in confidence.
|
2023-05-25 11:42:19 +01:00
|
|
|
"""Defines node behaviour for Green PoL."""
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
|
2023-05-25 11:42:19 +01:00
|
|
|
class NodeStateInstructionGreen(object):
|
2023-07-05 10:14:16 +01:00
|
|
|
"""The Node State Instruction class.#
|
|
|
|
|
|
|
|
|
|
:param _id: The node state instruction id
|
|
|
|
|
:param _start_step: The start step of the instruction
|
|
|
|
|
:param _end_step: The end step of the instruction
|
|
|
|
|
:param _node_id: The id of the associated node
|
|
|
|
|
:param _node_pol_type: The pattern of life type
|
|
|
|
|
:param _service_name: The service name
|
|
|
|
|
:param _state: The state (node or service)
|
|
|
|
|
"""
|
2023-05-25 11:42:19 +01:00
|
|
|
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
_id,
|
|
|
|
|
_start_step,
|
|
|
|
|
_end_step,
|
|
|
|
|
_node_id,
|
|
|
|
|
_node_pol_type,
|
|
|
|
|
_service_name,
|
|
|
|
|
_state,
|
|
|
|
|
):
|
2023-03-28 17:33:34 +01:00
|
|
|
self.id = _id
|
|
|
|
|
self.start_step = _start_step
|
|
|
|
|
self.end_step = _end_step
|
|
|
|
|
self.node_id = _node_id
|
|
|
|
|
self.node_pol_type = _node_pol_type
|
2023-05-25 11:42:19 +01:00
|
|
|
self.service_name = _service_name # Not used when not a service instruction
|
|
|
|
|
self.state = _state
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
def get_start_step(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the start step.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The start step
|
|
|
|
|
"""
|
|
|
|
|
return self.start_step
|
|
|
|
|
|
|
|
|
|
def get_end_step(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the end step.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The end step
|
|
|
|
|
"""
|
|
|
|
|
return self.end_step
|
|
|
|
|
|
|
|
|
|
def get_node_id(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the node ID.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The node ID
|
|
|
|
|
"""
|
|
|
|
|
return self.node_id
|
|
|
|
|
|
|
|
|
|
def get_node_pol_type(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the node pattern of life type (enum).
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The node pattern of life type (enum)
|
|
|
|
|
"""
|
|
|
|
|
return self.node_pol_type
|
|
|
|
|
|
|
|
|
|
def get_service_name(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the service name.
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The service name
|
|
|
|
|
"""
|
|
|
|
|
return self.service_name
|
|
|
|
|
|
|
|
|
|
def get_state(self):
|
2023-07-04 11:11:52 +01:00
|
|
|
"""Gets the state (node or service).
|
2023-03-28 17:33:34 +01:00
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
The state (node or service)
|
|
|
|
|
"""
|
|
|
|
|
return self.state
|