# SPDX-FileCopyrightText: 2025 Lubin Bailly # # SPDX-License-Identifier: EUPL-1.2 { lib, config, ... }: let inherit (lib) concatMapAttrsStringSep mkOption optionalString ; inherit (lib.types) attrsOf bool enum str submodule ; in { options = { snmp = { filter-interfaces.all-internal-interfaces = mkOption { type = bool; default = false; description = '' Whether to filter internal interfaces. ''; }; community = mkOption { type = attrsOf ( submodule ( { name, config, ... }: { options = { authorization = mkOption { type = enum [ "read-only" "read-write" ]; description = '' Authorization type. ''; }; xml = mkOption { type = str; visible = false; readOnly = true; }; }; config.xml = '' ${name} ${config.authorization} ''; } ) ); default = { }; description = '' Communities for SNMPv2 access. ''; }; }; netconf.xmls.snmp = mkOption { type = str; visible = false; readOnly = true; }; }; config.netconf.xmls.snmp = '' ${optionalString config.snmp.filter-interfaces.all-internal-interfaces ""} ${concatMapAttrsStringSep "" (_: comm: comm.xml) config.snmp.community} ''; }