Files
PrimAITE/src/primaite/simulator/system/services/dns_server.py
SunilSamra 76d404dc2f #1752 - Added dns_client.py and dns_server.py service files
- Added new get_install method to software.py
2023-08-15 13:56:38 +01:00

65 lines
2.0 KiB
Python

from abc import abstractmethod
from typing import Any, Dict, List
from pydantic import BaseModel
class DNSServer(BaseModel):
"""Represents a DNS Server as a Service."""
dns_table: dict[str:str] = {"https://google.co.uk": "8.8.8.8"}
@abstractmethod
def describe_state(self) -> Dict:
"""
Describes the current state of the software.
The specifics of the software's state, including its health, criticality,
and any other pertinent information, should be implemented in subclasses.
:return: A dictionary containing key-value pairs representing the current state of the software.
:rtype: Dict
"""
return {"Operating State": self.operating_state}
def apply_action(self, action: List[str]) -> None:
"""
Applies a list of actions to the Service.
:param action: A list of actions to apply.
"""
pass
def reset_component_for_episode(self):
"""
Resets the Service component for a new episode.
This method ensures the Service is ready for a new episode, including resetting any
stateful properties or statistics, and clearing any message queues.
"""
pass
def send(self, payload: Any, session_id: str, **kwargs) -> bool:
"""
Sends a payload to the SessionManager.
The specifics of how the payload is processed and whether a response payload
is generated should be implemented in subclasses.
:param payload: The payload to send.
:return: True if successful, False otherwise.
"""
pass
def receive(self, payload: Any, session_id: str, **kwargs) -> bool:
"""
Receives a payload from the SessionManager.
The specifics of how the payload is processed and whether a response payload
is generated should be implemented in subclasses.
:param payload: The payload to receive.
:return: True if successful, False otherwise.
"""
pass