summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromnom62 <omnom62@outlook.com>2026-07-07 16:51:15 +1000
committeromnom62 <omnom62@outlook.com>2026-07-07 16:51:15 +1000
commit3b03da286d24c9f9fc858f72df709712d89906f7 (patch)
tree45cf2dd36dd0a07c223377eaa3dacfc2d24d187e
parent075acc5bf3aef087e1b8ca617dad8a2bf96f3cfa (diff)
downloadvyos.vyos-test/lldp-interfaces-unit-tests.tar.gz
vyos.vyos-test/lldp-interfaces-unit-tests.zip
T8517: corrected unit testtest/lldp-interfaces-unit-tests
-rw-r--r--.coderabbit.yaml35
-rw-r--r--AGENTS.md7
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_lldp_interfaces.py4
3 files changed, 27 insertions, 19 deletions
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index c14e52eb..2b9a02a4 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -28,12 +28,12 @@ reviews:
# central already filters `!**/__pycache__/**`, `!**/*.pyc`,
# `!**/*.egg-info/**`, `!**/.venv/**`, `!**/.worktrees/**` — so they
# are not repeated here.
- - '!changelogs/changelog.yaml'
- - '!.collections/**'
+ - "!changelogs/changelog.yaml"
+ - "!.collections/**"
path_instructions:
# ── Global PR hygiene ──────────────────────────────────────────────
- - path: '**'
+ - path: "**"
instructions: |
This is the vyos.vyos Ansible network collection (namespace=vyos, name=vyos,
version=6.0.0). PR titles must follow the format `T{id}: description` referencing
@@ -46,7 +46,7 @@ reviews:
88-char wrapping.
# ── Module entry points ────────────────────────────────────────────
- - path: 'plugins/modules/vyos_*.py'
+ - path: "plugins/modules/vyos_*.py"
instructions: |
Module entry points. Each file must contain three YAML triple-string blocks:
DOCUMENTATION, EXAMPLES, and RETURN — this is Ansible's documentation contract,
@@ -63,7 +63,7 @@ reviews:
are the canonical documentation.
# ── Argspec (auto-generated) ───────────────────────────────────────
- - path: 'plugins/module_utils/network/vyos/argspec/**'
+ - path: "plugins/module_utils/network/vyos/argspec/**"
instructions: |
Auto-generated by the Ansible resource module builder. These files carry a
"DO NOT EDIT" warning header. Do not suggest modifications to auto-generated
@@ -73,7 +73,7 @@ reviews:
that would cause runtime failures.
# ── Config classes ─────────────────────────────────────────────────
- - path: 'plugins/module_utils/network/vyos/config/**'
+ - path: "plugins/module_utils/network/vyos/config/**"
instructions: |
Config builders extending ansible.netcommon ConfigBase or ResourceModule.
These generate VyOS CLI commands from desired state. Verify:
@@ -87,7 +87,7 @@ reviews:
Some older config files have auto-generated headers — do not restructure those.
# ── Facts classes ──────────────────────────────────────────────────
- - path: 'plugins/module_utils/network/vyos/facts/**'
+ - path: "plugins/module_utils/network/vyos/facts/**"
instructions: |
Facts classes parse raw VyOS CLI output into structured dicts. Verify:
- Regex patterns handle edge cases (missing fields, empty values, quoted strings).
@@ -99,7 +99,7 @@ reviews:
get_resource_connection().
# ── RM Templates ───────────────────────────────────────────────────
- - path: 'plugins/module_utils/network/vyos/rm_templates/*.py'
+ - path: "plugins/module_utils/network/vyos/rm_templates/*.py"
instructions: |
Parser templates mapping structured data to VyOS CLI commands and vice versa.
Files with a `_14` suffix target VyOS 1.4+ behavior — do not suggest merging
@@ -111,7 +111,7 @@ reviews:
- compval/getval paths match the argspec structure.
# ── Cliconf plugin ─────────────────────────────────────────────────
- - path: 'plugins/cliconf/vyos.py'
+ - path: "plugins/cliconf/vyos.py"
instructions: |
Low-level CLI abstraction for VyOS. Handles configure mode, commit, diff,
command execution. Changes here affect all modules. Verify:
@@ -122,7 +122,7 @@ reviews:
- __rpc__ list matches actually implemented methods.
# ── Terminal plugin ────────────────────────────────────────────────
- - path: 'plugins/terminal/vyos.py'
+ - path: "plugins/terminal/vyos.py"
instructions: |
Terminal prompt detection and initialization. Changes affect connection
reliability. Verify regex patterns against actual VyOS prompt formats
@@ -130,14 +130,14 @@ reviews:
remove existing patterns without testing against all supported VyOS versions.
# ── Action plugin ──────────────────────────────────────────────────
- - path: 'plugins/action/vyos.py'
+ - path: "plugins/action/vyos.py"
instructions: |
Auto-proxies all modules to the device. Must validate network_cli connection
type. Symlinks from each module name point here. Keep minimal — logic belongs
in config classes, not the action plugin.
# ── Changelog fragments ────────────────────────────────────────────
- - path: 'changelogs/fragments/*.{yaml,yml}'
+ - path: "changelogs/fragments/*.{yaml,yml}"
instructions: |
Changelog fragments for ansible-changelog. Valid top-level keys:
major_changes, minor_changes, breaking_changes, deprecated_features,
@@ -147,7 +147,7 @@ reviews:
Use `trivial` for tooling/housekeeping. Entries should be complete sentences.
# ── CI workflows ───────────────────────────────────────────────────
- - path: '.github/workflows/**'
+ - path: ".github/workflows/**"
instructions: |
CI pipeline: tests.yml (main CI with changelog, build, lint, sanity, unit jobs),
codecoverage.yml, release.yml (Galaxy + Automation Hub publish), check_label.yaml,
@@ -156,7 +156,7 @@ reviews:
job from tests.yml.
# ── Unit tests ─────────────────────────────────────────────────────
- - path: 'tests/unit/**'
+ - path: "tests/unit/**"
instructions: |
Unit tests use pytest + unittest.TestCase via TestVyosModule base class.
Key patterns:
@@ -171,7 +171,7 @@ reviews:
execute_module kwargs. pytest-xdist runs tests in parallel (-n 2).
# ── Test fixtures ──────────────────────────────────────────────────
- - path: 'tests/unit/modules/network/vyos/fixtures/**'
+ - path: "tests/unit/modules/network/vyos/fixtures/**"
instructions: |
Raw VyOS CLI output files (.cfg). These are loaded by load_fixture() and
cached in memory. Format is VyOS `set ...` configuration syntax or show
@@ -181,20 +181,19 @@ reviews:
unless the test explicitly requires JSON parsing.
# ── Collection metadata ────────────────────────────────────────────
- - path: 'galaxy.yml'
+ - path: "galaxy.yml"
instructions: |
Collection metadata. namespace=vyos, name=vyos. Version bumps must be
coordinated with release process. Dependency on ansible.netcommon>=2.5.1
is required. Do not add unnecessary dependencies.
- - path: 'meta/runtime.yml'
+ - path: "meta/runtime.yml"
instructions: |
Module redirects and tombstones. Adding a new module requires a redirect
entry (short name → FQCN). Tombstoned modules (logging, vyos_logging) must
not be un-tombstoned. requires_ansible must stay >=2.15.0 unless explicitly
bumping minimum version.
-
knowledge_base:
jira:
# `auto` activates Jira context lookups when this repo lives on an
diff --git a/AGENTS.md b/AGENTS.md
index f14e1246..b3a16f79 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,20 +1,24 @@
# AGENTS.md
## Project purpose
+
The official Ansible Collection for managing VyOS network appliances (`vyos.vyos` namespace). Provides modules, plugins, action handlers, terminal plugins, and resource modules for BGP, OSPF, firewall, interfaces, NTP, etc.
## Tech stack
+
- Ansible Collection (Galaxy). Python control-plane code under `plugins/`.
- `galaxy.yml` declares `namespace: vyos`, `name: vyos`, `version: 6.0.0`, dep `ansible.netcommon >= 2.5.1`, license_file `LICENSE` (GPL-3.0).
- Test stack: `pytest` + `tox-ansible.ini`; lint via flake8, isort, black (line-length 100), pre-commit, ansible-lint.
- Runtime deps: `paramiko`, `scp` (`requirements.txt`); `bindep.txt` for system deps.
## Build / test / run
+
- Build: `ansible-galaxy collection build` produces a `vyos-vyos-<version>.tar.gz`.
- Install local dev: `ansible-galaxy collection install . --force`.
- Test (unit): `ansible-test units` (matches `unit-galaxy` CI job; requires collection installed under `~/.ansible/collections/`). Fast local alternative: `source .venv/bin/activate && PYTHONPATH=".collections" python -m pytest tests/unit` (matches `unit-source` CI path; config in `pyproject.toml`). CI (`.github/workflows/tests.yml`) runs the changelog / build-import / ansible-lint / sanity / unit-galaxy / unit-source jobs; integration tests live under `tests/integration/` but are not yet wired into CI. Per `README.md`, the collection targets VyOS 1.3.8 / 1.4.1 / 1.5-rolling (no version matrix in the workflow itself).
## Repository layout
+
- `plugins/{action,cliconf,doc_fragments,filter,inventory,module_utils,modules,terminal}/` — collection content.
- `tests/` — sanity, unit, integration directories. CI (`.github/workflows/tests.yml`) runs sanity + unit-galaxy + unit-source (plus changelog / build-import / ansible-lint); integration is not yet wired into CI.
- `docs/` — generated module docs.
@@ -23,10 +27,12 @@ The official Ansible Collection for managing VyOS network appliances (`vyos.vyos
- `.github/workflows/` — `tests.yml`, `release.yml`, `codecoverage.yml`, `cla-check.yml`, `ah_token_refresh.yml`, `check_label.yaml`.
## Cross-repo context
+
- Consumed by Ansible users running playbooks against VyOS routers built by `vyos/vyos-build`.
- The `vyos.vyos` collection talks to VyOS via `network_cli` connections; supports the same train branches (`rolling`, `circinus`, `sagitta`, `equuleus`).
## Conventions
+
- Commit headline: `T12345: description` (Phorge ID at https://vyos.dev mandatory). No workflow enforces PR title format in this repo.
- Every PR must include exactly one changelog fragment under `changelogs/fragments/`; use `doc_changes` for documentation-only updates, or `trivial` for tooling / housekeeping changes.
- Default branch `main` (not `current` — this repo predates the rename convention).
@@ -34,6 +40,7 @@ The official Ansible Collection for managing VyOS network appliances (`vyos.vyos
- Codecov + CodeRabbit configured (`codecov.yml`, `.coderabbit.yaml`).
## Notes for future contributors
+
- Galaxy versioning is independent of VyOS train versioning — bump in `galaxy.yml` per release.
- Tested matrix is in README; expand only after smoketesting against real images.
- `PR408_README.md` plus `pr408-diagram.png` document a non-trivial historical refactor; read before touching resource-module structure.
diff --git a/tests/unit/modules/network/vyos/test_vyos_lldp_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_lldp_interfaces.py
index fdb1cecd..fda8f7f4 100644
--- a/tests/unit/modules/network/vyos/test_vyos_lldp_interfaces.py
+++ b/tests/unit/modules/network/vyos/test_vyos_lldp_interfaces.py
@@ -51,7 +51,7 @@ class TestVyosLldpInterfacesModule(TestVyosModule):
def load_fixtures(self, commands=None, filename=None):
self.get_resource_connection_facts.return_value.get_config.return_value = load_fixture(
- "vyos_lldp_interfaces_config.cfg"
+ "vyos_lldp_interfaces_config.cfg",
)
# -------------------------------------------------------------------------
@@ -227,6 +227,8 @@ class TestVyosLldpInterfacesModule(TestVyosModule):
coord = eth2["location"]["coordinate_based"]
self.assertEqual(coord["altitude"], 2200)
self.assertEqual(coord["datum"], "WGS84")
+ self.assertEqual(coord["latitude"], "33.524449N")
+ self.assertEqual(coord["longitude"], "222.267255W")
# -------------------------------------------------------------------------
# rendered