bugfix - Make node schemas stricter

This commit is contained in:
Marek Wolan
2025-02-05 15:04:41 +00:00
parent 4a472c5c75
commit c1abbfe58c
17 changed files with 73 additions and 34 deletions

View File

@@ -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] = {}