diff --git a/napalm_proxmox/system_mixin.py b/napalm_proxmox/system_mixin.py index 7b70efb..b2aa271 100644 --- a/napalm_proxmox/system_mixin.py +++ b/napalm_proxmox/system_mixin.py @@ -820,3 +820,47 @@ class ProxmoxSystemMixin: result[dev] = entry return result + + def get_system_config(self) -> dict[str, Any]: + """Return system-level configuration for this Proxmox node. + + Collected from ``/cluster/status`` and the node config API: + + * ``cluster_name`` (str | None) — Proxmox cluster name; ``None`` when + the node is standalone (not part of a cluster). + * ``cluster_nodes`` (list[str]) — hostnames of all online cluster nodes. + * ``hostname`` (str) — this node's name as reported by the cluster. + * ``timezone`` (str | None) — e.g. ``"Europe/Berlin"``. + * ``ntp_servers`` (list[str]). + * ``ssh_port`` (int) — always 22 for Proxmox nodes. + * ``ssh_password_auth`` (bool) — ``False`` as a safe default. + """ + cfg: dict[str, Any] = { + "cluster_name": None, + "cluster_nodes": [], + "hostname": self._node_name, + "timezone": None, + "ntp_servers": [], + "ssh_port": 22, + "ssh_password_auth": False, + } + + # Cluster name and node list from /cluster/status + try: + status = self._api.cluster.status.get() or [] + for entry in status: + if entry.get("type") == "cluster": + cfg["cluster_name"] = entry.get("name") + elif entry.get("type") == "node" and entry.get("online"): + cfg["cluster_nodes"].append(entry.get("name", "")) + except Exception as exc: + logger.debug("Failed to fetch cluster status for system config: %s", exc) + + # Timezone from node time API + try: + time_cfg = self._node_api().time.get() or {} + cfg["timezone"] = time_cfg.get("timezone") or None + except Exception as exc: + logger.debug("Failed to fetch node time config: %s", exc) + + return cfg