Add Install method to software.
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
from abc import abstractmethod
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, Set
|
||||
from typing import Any, Dict, Set, TYPE_CHECKING
|
||||
|
||||
from primaite.simulator.core import Action, ActionManager, SimComponent
|
||||
from primaite.simulator.network.transmission.transport_layer import Port
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from primaite.simulator.network.hardware.base import Node
|
||||
|
||||
|
||||
class SoftwareType(Enum):
|
||||
"""
|
||||
@@ -132,6 +135,20 @@ class Software(SimComponent):
|
||||
"""
|
||||
self.health_state_actual = health_state
|
||||
|
||||
@abstractmethod
|
||||
def install(self) -> None:
|
||||
"""
|
||||
Perform first-time setup of this service on a node.
|
||||
|
||||
This is an abstract class that should be overwritten by specific applications or services. It must be called
|
||||
after the service is already associate with a node. For example, a service may need to authenticate with a
|
||||
server during installation, or create files in the node's filesystem.
|
||||
|
||||
:param node: Node on which this software runs.
|
||||
:type node: Node
|
||||
"""
|
||||
parent: "Node" = self.parent # noqa
|
||||
|
||||
def scan(self) -> None:
|
||||
"""Update the observed health status to match the actual health status."""
|
||||
self.health_state_visible = self.health_state_actual
|
||||
|
||||
Reference in New Issue
Block a user