Add ability to uninstall service

This commit is contained in:
Marek Wolan
2023-08-29 14:15:49 +01:00
parent 9c8b7a7b7a
commit f0b82cbdfb
5 changed files with 74 additions and 15 deletions

View File

@@ -1,13 +1,10 @@
from abc import abstractmethod
from enum import Enum
from typing import Any, Dict, Set, TYPE_CHECKING
from typing import Any, Dict, Set
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):
"""
@@ -143,11 +140,17 @@ class Software(SimComponent):
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
pass
def uninstall(self) -> None:
"""Uninstall this service from a node.
This is an abstract class that should be overwritten by applications or services. It must be called after the
`install` method has already been run on that node. It should undo any installation steps, for example by
deleting files, or contacting a server.
"""
pass
def scan(self) -> None:
"""Update the observed health status to match the actual health status."""