From 139b4f59cdf8e051cee2a896fb59bb4476910b43 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Thu, 16 Apr 2026 07:13:23 +0300 Subject: T8518: add unit tests for vyos_vlan module - Fix copyright header to use VyOS Networks attribution - Add 'Make coding more python3-ish' comment per test suite convention - Fix load_fixtures to select empty fixture via filename='empty' parameter - Update purge test to assert correct post-fix behavior (no vif None commands) - Apply vyos_vlan purge fix to allow tests to pass (will be superseded by T8520 on merge) Co-Authored-By: Claude Sonnet 4.6 --- plugins/modules/vyos_vlan.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'plugins/modules') diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py index f0b68bc9..9d23cc7c 100644 --- a/plugins/modules/vyos_vlan.py +++ b/plugins/modules/vyos_vlan.py @@ -279,15 +279,11 @@ def map_config_to_obj(module): obj = {} eth = splitted_line[0].strip("'") - if eth.startswith("eth"): + if eth.startswith("eth") and "." in eth: obj["interfaces"] = [] - if "." in eth: - interface = eth.split(".")[0] - obj["interfaces"].append(interface) - obj["vlan_id"] = eth.split(".")[-1] - else: - obj["interfaces"].append(eth) - obj["vlan_id"] = None + interface = eth.split(".")[0] + obj["interfaces"].append(interface) + obj["vlan_id"] = eth.split(".")[-1] if splitted_line[1].strip("'") != "-": obj["address"] = splitted_line[1].strip("'") -- cgit v1.2.3