diff --git a/daemon/core/configservice/base.py b/daemon/core/configservice/base.py index 3d61edcc..e15260eb 100644 --- a/daemon/core/configservice/base.py +++ b/daemon/core/configservice/base.py @@ -5,7 +5,7 @@ import logging import time from dataclasses import dataclass from pathlib import Path -from typing import Any, Dict, List, Optional +from typing import Any, Optional from mako import exceptions from mako.lookup import TemplateLookup @@ -67,7 +67,7 @@ class ConfigService(abc.ABC): validation_timer: int = 5 # directories to shadow and copy files from - shadow_directories: List[ShadowDir] = [] + shadow_directories: list[ShadowDir] = [] def __init__(self, node: CoreNode) -> None: """ @@ -79,9 +79,9 @@ class ConfigService(abc.ABC): class_file = inspect.getfile(self.__class__) templates_path = Path(class_file).parent.joinpath(TEMPLATES_DIR) self.templates: TemplateLookup = TemplateLookup(directories=templates_path) - self.config: Dict[str, Configuration] = {} - self.custom_templates: Dict[str, str] = {} - self.custom_config: Dict[str, str] = {} + self.config: dict[str, Configuration] = {} + self.custom_templates: dict[str, str] = {} + self.custom_config: dict[str, str] = {} configs = self.default_configs[:] self._define_config(configs) @@ -108,47 +108,47 @@ class ConfigService(abc.ABC): @property @abc.abstractmethod - def directories(self) -> List[str]: + def directories(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def files(self) -> List[str]: + def files(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def default_configs(self) -> List[Configuration]: + def default_configs(self) -> list[Configuration]: raise NotImplementedError @property @abc.abstractmethod - def modes(self) -> Dict[str, Dict[str, str]]: + def modes(self) -> dict[str, dict[str, str]]: raise NotImplementedError @property @abc.abstractmethod - def executables(self) -> List[str]: + def executables(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def dependencies(self) -> List[str]: + def dependencies(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def startup(self) -> List[str]: + def startup(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def validate(self) -> List[str]: + def validate(self) -> list[str]: raise NotImplementedError @property @abc.abstractmethod - def shutdown(self) -> List[str]: + def shutdown(self) -> list[str]: raise NotImplementedError @property @@ -276,7 +276,7 @@ class ConfigService(abc.ABC): f"failure to create service directory: {directory}" ) - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: """ Returns key/value data, used when rendering file templates. @@ -303,7 +303,7 @@ class ConfigService(abc.ABC): """ raise CoreError(f"service({self.name}) unknown template({name})") - def get_templates(self) -> Dict[str, str]: + def get_templates(self) -> dict[str, str]: """ Retrieves mapping of file names to templates for all cases, which includes custom templates, file templates, and text templates. @@ -331,7 +331,7 @@ class ConfigService(abc.ABC): templates[file] = template return templates - def get_rendered_templates(self) -> Dict[str, str]: + def get_rendered_templates(self) -> dict[str, str]: templates = {} data = self.data() for file in sorted(self.files): @@ -339,7 +339,7 @@ class ConfigService(abc.ABC): templates[file] = rendered return templates - def _get_rendered_template(self, file: str, data: Dict[str, Any]) -> str: + def _get_rendered_template(self, file: str, data: dict[str, Any]) -> str: file_path = Path(file) template_path = get_template_path(file_path) if file in self.custom_templates: @@ -426,7 +426,7 @@ class ConfigService(abc.ABC): f"node({self.node.name}) service({self.name}) failed to validate" ) - def _render(self, template: Template, data: Dict[str, Any] = None) -> str: + def _render(self, template: Template, data: dict[str, Any] = None) -> str: """ Renders template providing all associated data to template. @@ -440,7 +440,7 @@ class ConfigService(abc.ABC): node=self.node, config=self.render_config(), **data ) - def render_text(self, text: str, data: Dict[str, Any] = None) -> str: + def render_text(self, text: str, data: dict[str, Any] = None) -> str: """ Renders text based template providing all associated data to template. @@ -458,7 +458,7 @@ class ConfigService(abc.ABC): f"{exceptions.text_error_template().render_unicode()}" ) - def render_template(self, template_path: str, data: Dict[str, Any] = None) -> str: + def render_template(self, template_path: str, data: dict[str, Any] = None) -> str: """ Renders file based template providing all associated data to template. @@ -475,7 +475,7 @@ class ConfigService(abc.ABC): f"{exceptions.text_error_template().render_unicode()}" ) - def _define_config(self, configs: List[Configuration]) -> None: + def _define_config(self, configs: list[Configuration]) -> None: """ Initializes default configuration data. @@ -485,7 +485,7 @@ class ConfigService(abc.ABC): for config in configs: self.config[config.id] = config - def render_config(self) -> Dict[str, str]: + def render_config(self) -> dict[str, str]: """ Returns configuration data key/value pairs for rendering a template. @@ -496,7 +496,7 @@ class ConfigService(abc.ABC): else: return {k: v.default for k, v in self.config.items()} - def set_config(self, data: Dict[str, str]) -> None: + def set_config(self, data: dict[str, str]) -> None: """ Set configuration data from key/value pairs. diff --git a/daemon/core/configservice/dependencies.py b/daemon/core/configservice/dependencies.py index b24c83c6..0bc5d4b6 100644 --- a/daemon/core/configservice/dependencies.py +++ b/daemon/core/configservice/dependencies.py @@ -1,5 +1,5 @@ import logging -from typing import TYPE_CHECKING, Dict, List, Set +from typing import TYPE_CHECKING logger = logging.getLogger(__name__) @@ -12,16 +12,16 @@ class ConfigServiceDependencies: Generates sets of services to start in order of their dependencies. """ - def __init__(self, services: Dict[str, "ConfigService"]) -> None: + def __init__(self, services: dict[str, "ConfigService"]) -> None: """ Create a ConfigServiceDependencies instance. :param services: services for determining dependency sets """ # helpers to check validity - self.dependents: Dict[str, Set[str]] = {} - self.started: Set[str] = set() - self.node_services: Dict[str, "ConfigService"] = {} + self.dependents: dict[str, set[str]] = {} + self.started: set[str] = set() + self.node_services: dict[str, "ConfigService"] = {} for service in services.values(): self.node_services[service.name] = service for dependency in service.dependencies: @@ -29,11 +29,11 @@ class ConfigServiceDependencies: dependents.add(service.name) # used to find paths - self.path: List["ConfigService"] = [] - self.visited: Set[str] = set() - self.visiting: Set[str] = set() + self.path: list["ConfigService"] = [] + self.visited: set[str] = set() + self.visiting: set[str] = set() - def startup_paths(self) -> List[List["ConfigService"]]: + def startup_paths(self) -> list[list["ConfigService"]]: """ Find startup path sets based on service dependencies. @@ -70,7 +70,7 @@ class ConfigServiceDependencies: self.visited.clear() self.visiting.clear() - def _start(self, service: "ConfigService") -> List["ConfigService"]: + def _start(self, service: "ConfigService") -> list["ConfigService"]: """ Starts a oath for checking dependencies for a given service. @@ -81,7 +81,7 @@ class ConfigServiceDependencies: self._reset() return self._visit(service) - def _visit(self, current_service: "ConfigService") -> List["ConfigService"]: + def _visit(self, current_service: "ConfigService") -> list["ConfigService"]: """ Visits a service when discovering dependency chains for service. diff --git a/daemon/core/configservice/manager.py b/daemon/core/configservice/manager.py index 1fd26e43..542f3cc5 100644 --- a/daemon/core/configservice/manager.py +++ b/daemon/core/configservice/manager.py @@ -2,7 +2,6 @@ import logging import pathlib import pkgutil from pathlib import Path -from typing import Dict, List, Type from core import configservices, utils from core.configservice.base import ConfigService @@ -20,9 +19,9 @@ class ConfigServiceManager: """ Create a ConfigServiceManager instance. """ - self.services: Dict[str, Type[ConfigService]] = {} + self.services: dict[str, type[ConfigService]] = {} - def get_service(self, name: str) -> Type[ConfigService]: + def get_service(self, name: str) -> type[ConfigService]: """ Retrieve a service by name. @@ -35,7 +34,7 @@ class ConfigServiceManager: raise CoreError(f"service does not exist {name}") return service_class - def add(self, service: Type[ConfigService]) -> None: + def add(self, service: type[ConfigService]) -> None: """ Add service to manager, checking service requirements have been met. @@ -62,7 +61,7 @@ class ConfigServiceManager: # make service available self.services[name] = service - def load_locals(self) -> List[str]: + def load_locals(self) -> list[str]: """ Search and add config service from local core module. @@ -81,7 +80,7 @@ class ConfigServiceManager: logger.debug("not loading config service(%s): %s", service.name, e) return errors - def load(self, path: Path) -> List[str]: + def load(self, path: Path) -> list[str]: """ Search path provided for config services and add them for being managed. diff --git a/daemon/core/configservices/frrservices/services.py b/daemon/core/configservices/frrservices/services.py index 7ed965be..bc3c2610 100644 --- a/daemon/core/configservices/frrservices/services.py +++ b/daemon/core/configservices/frrservices/services.py @@ -1,5 +1,5 @@ import abc -from typing import Any, Dict, List +from typing import Any from core.config import Configuration from core.configservice.base import ConfigService, ConfigServiceMode @@ -82,23 +82,23 @@ def rj45_check(iface: CoreInterface) -> bool: class FRRZebra(ConfigService): name: str = "FRRzebra" group: str = GROUP - directories: List[str] = ["/usr/local/etc/frr", "/var/run/frr", "/var/log/frr"] - files: List[str] = [ + directories: list[str] = ["/usr/local/etc/frr", "/var/run/frr", "/var/log/frr"] + files: list[str] = [ "/usr/local/etc/frr/frr.conf", "frrboot.sh", "/usr/local/etc/frr/vtysh.conf", "/usr/local/etc/frr/daemons", ] - executables: List[str] = ["zebra"] - dependencies: List[str] = [] - startup: List[str] = ["bash frrboot.sh zebra"] - validate: List[str] = ["pidof zebra"] - shutdown: List[str] = ["killall zebra"] + executables: list[str] = ["zebra"] + dependencies: list[str] = [] + startup: list[str] = ["bash frrboot.sh zebra"] + validate: list[str] = ["pidof zebra"] + shutdown: list[str] = ["killall zebra"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: frr_conf = self.files[0] frr_bin_search = self.node.session.options.get( "frr_bin_search", default="/usr/local/bin /usr/bin /usr/lib/frr" @@ -145,16 +145,16 @@ class FRRZebra(ConfigService): class FrrService(abc.ABC): group: str = GROUP - directories: List[str] = [] - files: List[str] = [] - executables: List[str] = [] - dependencies: List[str] = ["FRRzebra"] - startup: List[str] = [] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = [] + executables: list[str] = [] + dependencies: list[str] = ["FRRzebra"] + startup: list[str] = [] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} ipv4_routing: bool = False ipv6_routing: bool = False @@ -175,8 +175,8 @@ class FRROspfv2(FrrService, ConfigService): """ name: str = "FRROSPFv2" - shutdown: List[str] = ["killall ospfd"] - validate: List[str] = ["pidof ospfd"] + shutdown: list[str] = ["killall ospfd"] + validate: list[str] = ["pidof ospfd"] ipv4_routing: bool = True def frr_config(self) -> str: @@ -227,8 +227,8 @@ class FRROspfv3(FrrService, ConfigService): """ name: str = "FRROSPFv3" - shutdown: List[str] = ["killall ospf6d"] - validate: List[str] = ["pidof ospf6d"] + shutdown: list[str] = ["killall ospf6d"] + validate: list[str] = ["pidof ospf6d"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -264,8 +264,8 @@ class FRRBgp(FrrService, ConfigService): """ name: str = "FRRBGP" - shutdown: List[str] = ["killall bgpd"] - validate: List[str] = ["pidof bgpd"] + shutdown: list[str] = ["killall bgpd"] + validate: list[str] = ["pidof bgpd"] custom_needed: bool = True ipv4_routing: bool = True ipv6_routing: bool = True @@ -294,8 +294,8 @@ class FRRRip(FrrService, ConfigService): """ name: str = "FRRRIP" - shutdown: List[str] = ["killall ripd"] - validate: List[str] = ["pidof ripd"] + shutdown: list[str] = ["killall ripd"] + validate: list[str] = ["pidof ripd"] ipv4_routing: bool = True def frr_config(self) -> str: @@ -319,8 +319,8 @@ class FRRRipng(FrrService, ConfigService): """ name: str = "FRRRIPNG" - shutdown: List[str] = ["killall ripngd"] - validate: List[str] = ["pidof ripngd"] + shutdown: list[str] = ["killall ripngd"] + validate: list[str] = ["pidof ripngd"] ipv6_routing: bool = True def frr_config(self) -> str: @@ -345,8 +345,8 @@ class FRRBabel(FrrService, ConfigService): """ name: str = "FRRBabel" - shutdown: List[str] = ["killall babeld"] - validate: List[str] = ["pidof babeld"] + shutdown: list[str] = ["killall babeld"] + validate: list[str] = ["pidof babeld"] ipv6_routing: bool = True def frr_config(self) -> str: @@ -385,8 +385,8 @@ class FRRpimd(FrrService, ConfigService): """ name: str = "FRRpimd" - shutdown: List[str] = ["killall pimd"] - validate: List[str] = ["pidof pimd"] + shutdown: list[str] = ["killall pimd"] + validate: list[str] = ["pidof pimd"] ipv4_routing: bool = True def frr_config(self) -> str: diff --git a/daemon/core/configservices/nrlservices/services.py b/daemon/core/configservices/nrlservices/services.py index ba9ef29c..3002cd94 100644 --- a/daemon/core/configservices/nrlservices/services.py +++ b/daemon/core/configservices/nrlservices/services.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List +from typing import Any from core import utils from core.config import Configuration @@ -10,18 +10,18 @@ GROUP: str = "ProtoSvc" class MgenSinkService(ConfigService): name: str = "MGEN_Sink" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["mgensink.sh", "sink.mgen"] - executables: List[str] = ["mgen"] - dependencies: List[str] = [] - startup: List[str] = ["bash mgensink.sh"] - validate: List[str] = ["pidof mgen"] - shutdown: List[str] = ["killall mgen"] + directories: list[str] = [] + files: list[str] = ["mgensink.sh", "sink.mgen"] + executables: list[str] = ["mgen"] + dependencies: list[str] = [] + startup: list[str] = ["bash mgensink.sh"] + validate: list[str] = ["pidof mgen"] + shutdown: list[str] = ["killall mgen"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifnames = [] for iface in self.node.get_ifaces(): name = utils.sysctl_devname(iface.name) @@ -32,18 +32,18 @@ class MgenSinkService(ConfigService): class NrlNhdp(ConfigService): name: str = "NHDP" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["nrlnhdp.sh"] - executables: List[str] = ["nrlnhdp"] - dependencies: List[str] = [] - startup: List[str] = ["bash nrlnhdp.sh"] - validate: List[str] = ["pidof nrlnhdp"] - shutdown: List[str] = ["killall nrlnhdp"] + directories: list[str] = [] + files: list[str] = ["nrlnhdp.sh"] + executables: list[str] = ["nrlnhdp"] + dependencies: list[str] = [] + startup: list[str] = ["bash nrlnhdp.sh"] + validate: list[str] = ["pidof nrlnhdp"] + shutdown: list[str] = ["killall nrlnhdp"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.config_services ifnames = [] for iface in self.node.get_ifaces(control=False): @@ -54,18 +54,18 @@ class NrlNhdp(ConfigService): class NrlSmf(ConfigService): name: str = "SMF" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["startsmf.sh"] - executables: List[str] = ["nrlsmf", "killall"] - dependencies: List[str] = [] - startup: List[str] = ["bash startsmf.sh"] - validate: List[str] = ["pidof nrlsmf"] - shutdown: List[str] = ["killall nrlsmf"] + directories: list[str] = [] + files: list[str] = ["startsmf.sh"] + executables: list[str] = ["nrlsmf", "killall"] + dependencies: list[str] = [] + startup: list[str] = ["bash startsmf.sh"] + validate: list[str] = ["pidof nrlsmf"] + shutdown: list[str] = ["killall nrlsmf"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: has_nhdp = "NHDP" in self.node.config_services has_olsr = "OLSR" in self.node.config_services ifnames = [] @@ -84,18 +84,18 @@ class NrlSmf(ConfigService): class NrlOlsr(ConfigService): name: str = "OLSR" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["nrlolsrd.sh"] - executables: List[str] = ["nrlolsrd"] - dependencies: List[str] = [] - startup: List[str] = ["bash nrlolsrd.sh"] - validate: List[str] = ["pidof nrlolsrd"] - shutdown: List[str] = ["killall nrlolsrd"] + directories: list[str] = [] + files: list[str] = ["nrlolsrd.sh"] + executables: list[str] = ["nrlolsrd"] + dependencies: list[str] = [] + startup: list[str] = ["bash nrlolsrd.sh"] + validate: list[str] = ["pidof nrlolsrd"] + shutdown: list[str] = ["killall nrlolsrd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.config_services has_zebra = "zebra" in self.node.config_services ifname = None @@ -108,18 +108,18 @@ class NrlOlsr(ConfigService): class NrlOlsrv2(ConfigService): name: str = "OLSRv2" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["nrlolsrv2.sh"] - executables: List[str] = ["nrlolsrv2"] - dependencies: List[str] = [] - startup: List[str] = ["bash nrlolsrv2.sh"] - validate: List[str] = ["pidof nrlolsrv2"] - shutdown: List[str] = ["killall nrlolsrv2"] + directories: list[str] = [] + files: list[str] = ["nrlolsrv2.sh"] + executables: list[str] = ["nrlolsrv2"] + dependencies: list[str] = [] + startup: list[str] = ["bash nrlolsrv2.sh"] + validate: list[str] = ["pidof nrlolsrv2"] + shutdown: list[str] = ["killall nrlolsrv2"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.config_services ifnames = [] for iface in self.node.get_ifaces(control=False): @@ -130,18 +130,18 @@ class NrlOlsrv2(ConfigService): class OlsrOrg(ConfigService): name: str = "OLSRORG" group: str = GROUP - directories: List[str] = ["/etc/olsrd"] - files: List[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"] - executables: List[str] = ["olsrd"] - dependencies: List[str] = [] - startup: List[str] = ["bash olsrd.sh"] - validate: List[str] = ["pidof olsrd"] - shutdown: List[str] = ["killall olsrd"] + directories: list[str] = ["/etc/olsrd"] + files: list[str] = ["olsrd.sh", "/etc/olsrd/olsrd.conf"] + executables: list[str] = ["olsrd"] + dependencies: list[str] = [] + startup: list[str] = ["bash olsrd.sh"] + validate: list[str] = ["pidof olsrd"] + shutdown: list[str] = ["killall olsrd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.config_services ifnames = [] for iface in self.node.get_ifaces(control=False): @@ -152,13 +152,13 @@ class OlsrOrg(ConfigService): class MgenActor(ConfigService): name: str = "MgenActor" group: str = GROUP - directories: List[str] = [] - files: List[str] = ["start_mgen_actor.sh"] - executables: List[str] = ["mgen"] - dependencies: List[str] = [] - startup: List[str] = ["bash start_mgen_actor.sh"] - validate: List[str] = ["pidof mgen"] - shutdown: List[str] = ["killall mgen"] + directories: list[str] = [] + files: list[str] = ["start_mgen_actor.sh"] + executables: list[str] = ["mgen"] + dependencies: list[str] = [] + startup: list[str] = ["bash start_mgen_actor.sh"] + validate: list[str] = ["pidof mgen"] + shutdown: list[str] = ["killall mgen"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} diff --git a/daemon/core/configservices/quaggaservices/services.py b/daemon/core/configservices/quaggaservices/services.py index 8aa85807..8b4d4909 100644 --- a/daemon/core/configservices/quaggaservices/services.py +++ b/daemon/core/configservices/quaggaservices/services.py @@ -1,6 +1,6 @@ import abc import logging -from typing import Any, Dict, List +from typing import Any from core.config import Configuration from core.configservice.base import ConfigService, ConfigServiceMode @@ -84,22 +84,22 @@ def rj45_check(iface: CoreInterface) -> bool: class Zebra(ConfigService): name: str = "zebra" group: str = GROUP - directories: List[str] = ["/usr/local/etc/quagga", "/var/run/quagga"] - files: List[str] = [ + directories: list[str] = ["/usr/local/etc/quagga", "/var/run/quagga"] + files: list[str] = [ "/usr/local/etc/quagga/Quagga.conf", "quaggaboot.sh", "/usr/local/etc/quagga/vtysh.conf", ] - executables: List[str] = ["zebra"] - dependencies: List[str] = [] - startup: List[str] = ["bash quaggaboot.sh zebra"] - validate: List[str] = ["pidof zebra"] - shutdown: List[str] = ["killall zebra"] + executables: list[str] = ["zebra"] + dependencies: list[str] = [] + startup: list[str] = ["bash quaggaboot.sh zebra"] + validate: list[str] = ["pidof zebra"] + shutdown: list[str] = ["killall zebra"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: quagga_bin_search = self.node.session.options.get( "quagga_bin_search", default="/usr/local/bin /usr/bin /usr/lib/quagga" ).strip('"') @@ -153,16 +153,16 @@ class Zebra(ConfigService): class QuaggaService(abc.ABC): group: str = GROUP - directories: List[str] = [] - files: List[str] = [] - executables: List[str] = [] - dependencies: List[str] = ["zebra"] - startup: List[str] = [] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = [] + executables: list[str] = [] + dependencies: list[str] = ["zebra"] + startup: list[str] = [] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} ipv4_routing: bool = False ipv6_routing: bool = False @@ -183,8 +183,8 @@ class Ospfv2(QuaggaService, ConfigService): """ name: str = "OSPFv2" - validate: List[str] = ["pidof ospfd"] - shutdown: List[str] = ["killall ospfd"] + validate: list[str] = ["pidof ospfd"] + shutdown: list[str] = ["killall ospfd"] ipv4_routing: bool = True def quagga_iface_config(self, iface: CoreInterface) -> str: @@ -234,8 +234,8 @@ class Ospfv3(QuaggaService, ConfigService): """ name: str = "OSPFv3" - shutdown: List[str] = ["killall ospf6d"] - validate: List[str] = ["pidof ospf6d"] + shutdown: list[str] = ["killall ospf6d"] + validate: list[str] = ["pidof ospf6d"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -300,8 +300,8 @@ class Bgp(QuaggaService, ConfigService): """ name: str = "BGP" - shutdown: List[str] = ["killall bgpd"] - validate: List[str] = ["pidof bgpd"] + shutdown: list[str] = ["killall bgpd"] + validate: list[str] = ["pidof bgpd"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -329,8 +329,8 @@ class Rip(QuaggaService, ConfigService): """ name: str = "RIP" - shutdown: List[str] = ["killall ripd"] - validate: List[str] = ["pidof ripd"] + shutdown: list[str] = ["killall ripd"] + validate: list[str] = ["pidof ripd"] ipv4_routing: bool = True def quagga_config(self) -> str: @@ -354,8 +354,8 @@ class Ripng(QuaggaService, ConfigService): """ name: str = "RIPNG" - shutdown: List[str] = ["killall ripngd"] - validate: List[str] = ["pidof ripngd"] + shutdown: list[str] = ["killall ripngd"] + validate: list[str] = ["pidof ripngd"] ipv6_routing: bool = True def quagga_config(self) -> str: @@ -380,8 +380,8 @@ class Babel(QuaggaService, ConfigService): """ name: str = "Babel" - shutdown: List[str] = ["killall babeld"] - validate: List[str] = ["pidof babeld"] + shutdown: list[str] = ["killall babeld"] + validate: list[str] = ["pidof babeld"] ipv6_routing: bool = True def quagga_config(self) -> str: @@ -420,8 +420,8 @@ class Xpimd(QuaggaService, ConfigService): """ name: str = "Xpimd" - shutdown: List[str] = ["killall xpimd"] - validate: List[str] = ["pidof xpimd"] + shutdown: list[str] = ["killall xpimd"] + validate: list[str] = ["pidof xpimd"] ipv4_routing: bool = True def quagga_config(self) -> str: diff --git a/daemon/core/configservices/securityservices/services.py b/daemon/core/configservices/securityservices/services.py index e866617c..e6243b2c 100644 --- a/daemon/core/configservices/securityservices/services.py +++ b/daemon/core/configservices/securityservices/services.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List +from typing import Any from core.config import ConfigString, Configuration from core.configservice.base import ConfigService, ConfigServiceMode @@ -9,41 +9,41 @@ GROUP_NAME: str = "Security" class VpnClient(ConfigService): name: str = "VPNClient" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["vpnclient.sh"] - executables: List[str] = ["openvpn", "ip", "killall"] - dependencies: List[str] = [] - startup: List[str] = ["bash vpnclient.sh"] - validate: List[str] = ["pidof openvpn"] - shutdown: List[str] = ["killall openvpn"] + directories: list[str] = [] + files: list[str] = ["vpnclient.sh"] + executables: list[str] = ["openvpn", "ip", "killall"] + dependencies: list[str] = [] + startup: list[str] = ["bash vpnclient.sh"] + validate: list[str] = ["pidof openvpn"] + shutdown: list[str] = ["killall openvpn"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [ + default_configs: list[Configuration] = [ ConfigString(id="keydir", label="Key Dir", default="/etc/core/keys"), ConfigString(id="keyname", label="Key Name", default="client1"), ConfigString(id="server", label="Server", default="10.0.2.10"), ] - modes: Dict[str, Dict[str, str]] = {} + modes: dict[str, dict[str, str]] = {} class VpnServer(ConfigService): name: str = "VPNServer" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["vpnserver.sh"] - executables: List[str] = ["openvpn", "ip", "killall"] - dependencies: List[str] = [] - startup: List[str] = ["bash vpnserver.sh"] - validate: List[str] = ["pidof openvpn"] - shutdown: List[str] = ["killall openvpn"] + directories: list[str] = [] + files: list[str] = ["vpnserver.sh"] + executables: list[str] = ["openvpn", "ip", "killall"] + dependencies: list[str] = [] + startup: list[str] = ["bash vpnserver.sh"] + validate: list[str] = ["pidof openvpn"] + shutdown: list[str] = ["killall openvpn"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [ + default_configs: list[Configuration] = [ ConfigString(id="keydir", label="Key Dir", default="/etc/core/keys"), ConfigString(id="keyname", label="Key Name", default="server"), ConfigString(id="subnet", label="Subnet", default="10.0.200.0"), ] - modes: Dict[str, Dict[str, str]] = {} + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: address = None for iface in self.node.get_ifaces(control=False): ip4 = iface.get_ip4() @@ -56,48 +56,48 @@ class VpnServer(ConfigService): class IPsec(ConfigService): name: str = "IPsec" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["ipsec.sh"] - executables: List[str] = ["racoon", "ip", "setkey", "killall"] - dependencies: List[str] = [] - startup: List[str] = ["bash ipsec.sh"] - validate: List[str] = ["pidof racoon"] - shutdown: List[str] = ["killall racoon"] + directories: list[str] = [] + files: list[str] = ["ipsec.sh"] + executables: list[str] = ["racoon", "ip", "setkey", "killall"] + dependencies: list[str] = [] + startup: list[str] = ["bash ipsec.sh"] + validate: list[str] = ["pidof racoon"] + shutdown: list[str] = ["killall racoon"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} class Firewall(ConfigService): name: str = "Firewall" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["firewall.sh"] - executables: List[str] = ["iptables"] - dependencies: List[str] = [] - startup: List[str] = ["bash firewall.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["firewall.sh"] + executables: list[str] = ["iptables"] + dependencies: list[str] = [] + startup: list[str] = ["bash firewall.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} class Nat(ConfigService): name: str = "NAT" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["nat.sh"] - executables: List[str] = ["iptables"] - dependencies: List[str] = [] - startup: List[str] = ["bash nat.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["nat.sh"] + executables: list[str] = ["iptables"] + dependencies: list[str] = [] + startup: list[str] = ["bash nat.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifnames = [] for iface in self.node.get_ifaces(control=False): ifnames.append(iface.name) diff --git a/daemon/core/configservices/utilservices/services.py b/daemon/core/configservices/utilservices/services.py index 3a4addfe..805e9f49 100644 --- a/daemon/core/configservices/utilservices/services.py +++ b/daemon/core/configservices/utilservices/services.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List +from typing import Any import netaddr @@ -12,18 +12,18 @@ GROUP_NAME = "Utility" class DefaultRouteService(ConfigService): name: str = "DefaultRoute" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["defaultroute.sh"] - executables: List[str] = ["ip"] - dependencies: List[str] = [] - startup: List[str] = ["bash defaultroute.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["defaultroute.sh"] + executables: list[str] = ["ip"] + dependencies: list[str] = [] + startup: list[str] = ["bash defaultroute.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: # only add default routes for linked routing nodes routes = [] ifaces = self.node.get_ifaces() @@ -40,18 +40,18 @@ class DefaultRouteService(ConfigService): class DefaultMulticastRouteService(ConfigService): name: str = "DefaultMulticastRoute" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["defaultmroute.sh"] - executables: List[str] = [] - dependencies: List[str] = [] - startup: List[str] = ["bash defaultmroute.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["defaultmroute.sh"] + executables: list[str] = [] + dependencies: list[str] = [] + startup: list[str] = ["bash defaultmroute.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifname = None for iface in self.node.get_ifaces(control=False): ifname = iface.name @@ -62,18 +62,18 @@ class DefaultMulticastRouteService(ConfigService): class StaticRouteService(ConfigService): name: str = "StaticRoute" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["staticroute.sh"] - executables: List[str] = [] - dependencies: List[str] = [] - startup: List[str] = ["bash staticroute.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["staticroute.sh"] + executables: list[str] = [] + dependencies: list[str] = [] + startup: list[str] = ["bash staticroute.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: routes = [] for iface in self.node.get_ifaces(control=False): for ip in iface.ips(): @@ -90,18 +90,18 @@ class StaticRouteService(ConfigService): class IpForwardService(ConfigService): name: str = "IPForward" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["ipforward.sh"] - executables: List[str] = ["sysctl"] - dependencies: List[str] = [] - startup: List[str] = ["bash ipforward.sh"] - validate: List[str] = [] - shutdown: List[str] = [] + directories: list[str] = [] + files: list[str] = ["ipforward.sh"] + executables: list[str] = ["sysctl"] + dependencies: list[str] = [] + startup: list[str] = ["bash ipforward.sh"] + validate: list[str] = [] + shutdown: list[str] = [] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: devnames = [] for iface in self.node.get_ifaces(): devname = utils.sysctl_devname(iface.name) @@ -112,18 +112,18 @@ class IpForwardService(ConfigService): class SshService(ConfigService): name: str = "SSH" group: str = GROUP_NAME - directories: List[str] = ["/etc/ssh", "/var/run/sshd"] - files: List[str] = ["startsshd.sh", "/etc/ssh/sshd_config"] - executables: List[str] = ["sshd"] - dependencies: List[str] = [] - startup: List[str] = ["bash startsshd.sh"] - validate: List[str] = [] - shutdown: List[str] = ["killall sshd"] + directories: list[str] = ["/etc/ssh", "/var/run/sshd"] + files: list[str] = ["startsshd.sh", "/etc/ssh/sshd_config"] + executables: list[str] = ["sshd"] + dependencies: list[str] = [] + startup: list[str] = ["bash startsshd.sh"] + validate: list[str] = [] + shutdown: list[str] = ["killall sshd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: return dict( sshcfgdir=self.directories[0], sshstatedir=self.directories[1], @@ -134,18 +134,18 @@ class SshService(ConfigService): class DhcpService(ConfigService): name: str = "DHCP" group: str = GROUP_NAME - directories: List[str] = ["/etc/dhcp", "/var/lib/dhcp"] - files: List[str] = ["/etc/dhcp/dhcpd.conf"] - executables: List[str] = ["dhcpd"] - dependencies: List[str] = [] - startup: List[str] = ["touch /var/lib/dhcp/dhcpd.leases", "dhcpd"] - validate: List[str] = ["pidof dhcpd"] - shutdown: List[str] = ["killall dhcpd"] + directories: list[str] = ["/etc/dhcp", "/var/lib/dhcp"] + files: list[str] = ["/etc/dhcp/dhcpd.conf"] + executables: list[str] = ["dhcpd"] + dependencies: list[str] = [] + startup: list[str] = ["touch /var/lib/dhcp/dhcpd.leases", "dhcpd"] + validate: list[str] = ["pidof dhcpd"] + shutdown: list[str] = ["killall dhcpd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: subnets = [] for iface in self.node.get_ifaces(control=False): for ip4 in iface.ip4s: @@ -162,18 +162,18 @@ class DhcpService(ConfigService): class DhcpClientService(ConfigService): name: str = "DHCPClient" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["startdhcpclient.sh"] - executables: List[str] = ["dhclient"] - dependencies: List[str] = [] - startup: List[str] = ["bash startdhcpclient.sh"] - validate: List[str] = ["pidof dhclient"] - shutdown: List[str] = ["killall dhclient"] + directories: list[str] = [] + files: list[str] = ["startdhcpclient.sh"] + executables: list[str] = ["dhclient"] + dependencies: list[str] = [] + startup: list[str] = ["bash startdhcpclient.sh"] + validate: list[str] = ["pidof dhclient"] + shutdown: list[str] = ["killall dhclient"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifnames = [] for iface in self.node.get_ifaces(control=False): ifnames.append(iface.name) @@ -183,33 +183,33 @@ class DhcpClientService(ConfigService): class FtpService(ConfigService): name: str = "FTP" group: str = GROUP_NAME - directories: List[str] = ["/var/run/vsftpd/empty", "/var/ftp"] - files: List[str] = ["vsftpd.conf"] - executables: List[str] = ["vsftpd"] - dependencies: List[str] = [] - startup: List[str] = ["vsftpd ./vsftpd.conf"] - validate: List[str] = ["pidof vsftpd"] - shutdown: List[str] = ["killall vsftpd"] + directories: list[str] = ["/var/run/vsftpd/empty", "/var/ftp"] + files: list[str] = ["vsftpd.conf"] + executables: list[str] = ["vsftpd"] + dependencies: list[str] = [] + startup: list[str] = ["vsftpd ./vsftpd.conf"] + validate: list[str] = ["pidof vsftpd"] + shutdown: list[str] = ["killall vsftpd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} class PcapService(ConfigService): name: str = "pcap" group: str = GROUP_NAME - directories: List[str] = [] - files: List[str] = ["pcap.sh"] - executables: List[str] = ["tcpdump"] - dependencies: List[str] = [] - startup: List[str] = ["bash pcap.sh start"] - validate: List[str] = ["pidof tcpdump"] - shutdown: List[str] = ["bash pcap.sh stop"] + directories: list[str] = [] + files: list[str] = ["pcap.sh"] + executables: list[str] = ["tcpdump"] + dependencies: list[str] = [] + startup: list[str] = ["bash pcap.sh start"] + validate: list[str] = ["pidof tcpdump"] + shutdown: list[str] = ["bash pcap.sh stop"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifnames = [] for iface in self.node.get_ifaces(control=False): ifnames.append(iface.name) @@ -219,20 +219,20 @@ class PcapService(ConfigService): class RadvdService(ConfigService): name: str = "radvd" group: str = GROUP_NAME - directories: List[str] = ["/etc/radvd", "/var/run/radvd"] - files: List[str] = ["/etc/radvd/radvd.conf"] - executables: List[str] = ["radvd"] - dependencies: List[str] = [] - startup: List[str] = [ + directories: list[str] = ["/etc/radvd", "/var/run/radvd"] + files: list[str] = ["/etc/radvd/radvd.conf"] + executables: list[str] = ["radvd"] + dependencies: list[str] = [] + startup: list[str] = [ "radvd -C /etc/radvd/radvd.conf -m logfile -l /var/log/radvd.log" ] - validate: List[str] = ["pidof radvd"] - shutdown: List[str] = ["pkill radvd"] + validate: list[str] = ["pidof radvd"] + shutdown: list[str] = ["pkill radvd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifaces = [] for iface in self.node.get_ifaces(control=False): prefixes = [] @@ -247,22 +247,22 @@ class RadvdService(ConfigService): class AtdService(ConfigService): name: str = "atd" group: str = GROUP_NAME - directories: List[str] = ["/var/spool/cron/atjobs", "/var/spool/cron/atspool"] - files: List[str] = ["startatd.sh"] - executables: List[str] = ["atd"] - dependencies: List[str] = [] - startup: List[str] = ["bash startatd.sh"] - validate: List[str] = ["pidof atd"] - shutdown: List[str] = ["pkill atd"] + directories: list[str] = ["/var/spool/cron/atjobs", "/var/spool/cron/atspool"] + files: list[str] = ["startatd.sh"] + executables: list[str] = ["atd"] + dependencies: list[str] = [] + startup: list[str] = ["bash startatd.sh"] + validate: list[str] = ["pidof atd"] + shutdown: list[str] = ["pkill atd"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} class HttpService(ConfigService): name: str = "HTTP" group: str = GROUP_NAME - directories: List[str] = [ + directories: list[str] = [ "/etc/apache2", "/var/run/apache2", "/var/log/apache2", @@ -270,21 +270,21 @@ class HttpService(ConfigService): "/var/lock/apache2", "/var/www", ] - files: List[str] = [ + files: list[str] = [ "/etc/apache2/apache2.conf", "/etc/apache2/envvars", "/var/www/index.html", ] - executables: List[str] = ["apache2ctl"] - dependencies: List[str] = [] - startup: List[str] = ["chown www-data /var/lock/apache2", "apache2ctl start"] - validate: List[str] = ["pidof apache2"] - shutdown: List[str] = ["apache2ctl stop"] + executables: list[str] = ["apache2ctl"] + dependencies: list[str] = [] + startup: list[str] = ["chown www-data /var/lock/apache2", "apache2ctl start"] + validate: list[str] = ["pidof apache2"] + shutdown: list[str] = ["apache2ctl stop"] validation_mode: ConfigServiceMode = ConfigServiceMode.BLOCKING - default_configs: List[Configuration] = [] - modes: Dict[str, Dict[str, str]] = {} + default_configs: list[Configuration] = [] + modes: dict[str, dict[str, str]] = {} - def data(self) -> Dict[str, Any]: + def data(self) -> dict[str, Any]: ifaces = [] for iface in self.node.get_ifaces(control=False): ifaces.append(iface)