1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
#
# Per-repo CodeRabbit override for vyos/vyos.vyos (Ansible network collection).
#
# Most behavior is inherited from the org-level central baseline at
# https://github.com/vyos/coderabbit/blob/production/.coderabbit.yaml.
# This file keeps only what's distinct to this repo:
# - Ansible-collection-specific `path_instructions` (15 entries).
# - Two `path_filters` entries that aren't in the central list.
# - `base_branches: [main]` — central uses VyOS release-train names; this
# repo is an Ansible collection that lives on `main`.
# - `knowledge_base.jira` scoped to VD.
#
# Migrated from standalone (591-line rich config from T8584, sha
# 38eae56fb991b63e0c89245e4ef5fc130d3f5c8b) to centralized inheritance
# mode under T8851 on 2026-05-24. The standalone config preceded
# `vyos/coderabbit` central-config introduction (2026-05-12).
inheritance: true
reviews:
auto_review:
base_branches:
- main
path_filters:
# Repo-specific filters that aren't in the central baseline. The
# central already filters `!**/__pycache__/**`, `!**/*.pyc`,
# `!**/*.egg-info/**`, `!**/.venv/**`, `!**/.worktrees/**` — so they
# are not repeated here.
- "!changelogs/changelog.yaml"
- "!.collections/**"
path_instructions:
# ── Global PR hygiene ──────────────────────────────────────────────
- 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
a Phorge task at vyos.dev. Every PR must include a changelog fragment in
changelogs/fragments/ (YAML, valid keys: major_changes, minor_changes,
breaking_changes, deprecated_features, removed_features, security_fixes,
bugfixes, known_issues, doc_changes, trivial; plus release_summary as a
prelude section). Style: black line-length=100, isort
profile=black line_length=100, flake8 max-line-length=120. Do not suggest
88-char wrapping.
# ── Module entry points ────────────────────────────────────────────
- 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,
not Python docstrings. Verify:
- DOCUMENTATION includes: module, author, short_description, description,
version_added, extends_documentation_fragment (vyos.vyos.vyos), options with
types and descriptions, and a notes section listing tested VyOS versions.
- EXAMPLES has at least one working task per supported state.
- RETURN documents all return keys with description, returned, type, and sample.
- The module wires argspec, config, and facts classes correctly.
- State choices include the full set where applicable: merged, replaced,
overridden, deleted, gathered, parsed, rendered.
Do not add Python-style docstrings (def-level) to these files — the YAML blocks
are the canonical documentation.
# ── Argspec (auto-generated) ───────────────────────────────────────
- 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
argspec files — changes will be overwritten. If the schema needs updating,
the resource module builder must regenerate it. Only flag issues if the
argument_spec dict has obvious type mismatches or missing required fields
that would cause runtime failures.
# ── Config classes ─────────────────────────────────────────────────
- 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:
- execute_module() handles all declared states correctly.
- set_config() and _set_config() process gathered facts and desired config
without data loss.
- Command generation produces valid VyOS CLI syntax (set/delete prefixes,
proper quoting of values with spaces).
- No silent swallowing of unknown keys — unknown config should raise or warn.
- Methods that compare current vs desired state handle empty/None gracefully.
Some older config files have auto-generated headers — do not restructure those.
# ── Facts classes ──────────────────────────────────────────────────
- 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).
- populate() returns a clean dict even when device output is incomplete.
- get_device_data() uses the correct show command for the resource.
- facts/facts.py FACT_RESOURCE_SUBSETS and FACT_LEGACY_SUBSETS stay in sync
with available fact classes.
- Legacy facts (facts/legacy/) use run_commands(); resource facts use
get_resource_connection().
# ── RM Templates ───────────────────────────────────────────────────
- 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
them with the base version. Verify:
- _tmplt_* helper functions produce syntactically valid VyOS commands.
- Regex patterns in PARSERS list correctly capture all variations of the CLI
output (quoted values, optional fields, nested hierarchies).
- New templates include both set and delete command generation.
- compval/getval paths match the argspec structure.
# ── Cliconf plugin ─────────────────────────────────────────────────
- 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:
- edit_config() enters configure mode and commits correctly.
- get_diff() returns accurate before/after config diffs.
- Error handling catches VyOS-specific error patterns (commit failures,
invalid commands).
- __rpc__ list matches actually implemented methods.
# ── Terminal plugin ────────────────────────────────────────────────
- path: "plugins/terminal/vyos.py"
instructions: |
Terminal prompt detection and initialization. Changes affect connection
reliability. Verify regex patterns against actual VyOS prompt formats
(configure mode, operational mode, different shell variants). Do not
remove existing patterns without testing against all supported VyOS versions.
# ── Action plugin ──────────────────────────────────────────────────
- 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}"
instructions: |
Changelog fragments for ansible-changelog. Valid top-level keys:
major_changes, minor_changes, breaking_changes, deprecated_features,
removed_features, security_fixes, bugfixes, known_issues, doc_changes,
trivial. release_summary is a prelude section (one per release).
Fragment filename should be descriptive (e.g., fix-bgp-neighbor-timers.yml).
Use `trivial` for tooling/housekeeping. Entries should be complete sentences.
# ── CI 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,
cla-check.yml. Changes to release.yml or ah_token_refresh.yml affect publishing
credentials — review with extra care. Do not remove the `all_green` aggregation
job from tests.yml.
# ── Unit tests ─────────────────────────────────────────────────────
- path: "tests/unit/**"
instructions: |
Unit tests use pytest + unittest.TestCase via TestVyosModule base class.
Key patterns:
- All test classes inherit TestVyosModule (from vyos_module.py).
- setUp() creates and starts mock patches; tearDown() stops them.
- execute_module(failed, changed, commands, sort) is the primary assertion method.
- load_fixtures() is overridden per test class to wire mock return values.
- Fixture files (.cfg) go in tests/unit/modules/network/vyos/fixtures/.
- Use load_fixture(name) to read fixtures — never inline raw config strings.
- set_module_args(dict(...)) configures module input before execution.
Style: black line-length=100, assertions via self.assertEqual / self.assertIn /
execute_module kwargs. pytest-xdist runs tests in parallel (-n 2).
# ── Test 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
command output. Fixture filenames follow the pattern:
vyos_{module}_config.cfg (base) or vyos_{module}_config_v14.cfg (VyOS 1.4+).
New fixtures must be syntactically valid VyOS config. Do not add JSON fixtures
unless the test explicitly requires JSON parsing.
# ── Collection metadata ────────────────────────────────────────────
- 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"
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
# org with an Atlassian OAuth grant attached (VyOS-Networks); on the
# public vyos source it self-disables.
usage: auto
project_keys:
- VD
|