bugfix - Make node schemas stricter
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# © Crown-owned copyright 2025, Defence Science and Technology Laboratory UK
|
||||
from typing import Dict
|
||||
from typing import Dict, Literal
|
||||
|
||||
from prettytable import MARKDOWN, PrettyTable
|
||||
|
||||
@@ -18,6 +18,9 @@ class GigaSwitch(NetworkNode, discriminator="gigaswitch"):
|
||||
:ivar num_ports: The number of ports on the switch. Default is 24.
|
||||
"""
|
||||
|
||||
class ConfigSchema(NetworkNode.ConfigSchema):
|
||||
type: Literal["gigaswitch"] = "gigaswitch"
|
||||
|
||||
num_ports: int = 24
|
||||
"The number of ports on the switch."
|
||||
network_interfaces: Dict[str, SwitchPort] = {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# © Crown-owned copyright 2025, Defence Science and Technology Laboratory UK
|
||||
from typing import ClassVar, Dict
|
||||
from typing import ClassVar, Dict, Literal
|
||||
|
||||
from primaite.simulator.network.hardware.nodes.host.host_node import HostNode, NIC
|
||||
from primaite.simulator.system.services.ftp.ftp_client import FTPClient
|
||||
@@ -34,6 +34,9 @@ class SuperComputer(HostNode, discriminator="supercomputer"):
|
||||
* Web Browser
|
||||
"""
|
||||
|
||||
class ConfigSchema(HostNode.ConfigSchema):
|
||||
type: Literal["supercomputer"] = "supercomputer"
|
||||
|
||||
SYSTEM_SOFTWARE: ClassVar[Dict] = {**HostNode.SYSTEM_SOFTWARE, "ftp-client": FTPClient}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user