From 33ef6f86faf052bc3ea408e8098780df9898df99 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Tue, 30 Jun 2026 01:29:56 +0200 Subject: [PATCH] fix(get_config): strip timestamped event-log lines from running-config TP-Link embeds system event log entries (link up/down, etc.) in show running-config output. These change every event and cause false- positive config-change detections. Strip lines matching #YYYY-MM-DD. --- napalm_tplink_jetstream/tplink_jetstream.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/napalm_tplink_jetstream/tplink_jetstream.py b/napalm_tplink_jetstream/tplink_jetstream.py index 39264a4..f5cb12b 100644 --- a/napalm_tplink_jetstream/tplink_jetstream.py +++ b/napalm_tplink_jetstream/tplink_jetstream.py @@ -522,6 +522,19 @@ class TPLinkJetstreamDriver(ConfigLifecycleMixin, SwitchDriver): return interfaces_ip + @staticmethod + def _strip_event_log(config: str) -> str: + """Remove timestamped event-log lines from config output. + + TP-Link Jetstream embeds system event log entries in ``show running-config`` + output as lines like ``#2026-06-29 14:58:50,[Link]/5/Gi1/0/4 changed state``. + These lines are volatile and cause false-positive config-change events in + the config-backup feature. Strip them to keep the diff meaningful. + """ + import re + + return re.sub(r"^#\d{4}-\d{2}-\d{2} .*\n?", "", config, flags=re.MULTILINE) + def get_config( self, retrieve: str = "all", @@ -537,10 +550,10 @@ class TPLinkJetstreamDriver(ConfigLifecycleMixin, SwitchDriver): configs = {"running": "", "startup": "", "candidate": ""} if retrieve in ("all", "running"): - configs["running"] = self._send_command("show running-config") + configs["running"] = self._strip_event_log(self._send_command("show running-config")) if retrieve in ("all", "startup"): - configs["startup"] = self._send_command("show startup-config") + configs["startup"] = self._strip_event_log(self._send_command("show startup-config")) if sanitized: configs = napalm_helpers.sanitize_configs(configs, C.CISCO_SANITIZE_FILTERS)