diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-04-16 07:13:23 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-04-16 07:14:37 +0300 |
| commit | 139b4f59cdf8e051cee2a896fb59bb4476910b43 (patch) | |
| tree | 73c69f4fc018cd669f1406cc2367f8f6d4ce9047 /plugins/modules | |
| parent | a1ffdf253ce65a4dded7cedec7b41fbc4dcdb3ec (diff) | |
| download | vyos.vyos-139b4f59cdf8e051cee2a896fb59bb4476910b43.tar.gz vyos.vyos-139b4f59cdf8e051cee2a896fb59bb4476910b43.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'plugins/modules')
| -rw-r--r-- | plugins/modules/vyos_vlan.py | 12 |
1 files changed, 4 insertions, 8 deletions
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("'") |
