Skip to content

T9431: vyos_bgp_address_family - multiple mods (see the description) - #514

Draft
omnom62 wants to merge 8 commits into
vyos:mainfrom
omnom62:T9431_vyos_bgp_af
Draft

omnom62 wants to merge 8 commits into
vyos:mainfrom
omnom62:T9431_vyos_bgp_af

Conversation

@omnom62

@omnom62 omnom62 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor
  1. T9431: vyos_bgp_global / _address_family: Support neighbour ipv4-vpn options
  2. T9486: vyos_bgp_address_family: Sessions never come up: No BGP neighbors found
  3. T9418: vyos_bgp_address_family: Bare default-originate impossible.

Change Summary

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T9431
https://vyos.dev/T9486
https://vyos.dev/T9418

Related PR(s)

Component(s) name

bgp_address_family

Proposed changes

How to test

Test results

  • Sanity tests passed
  • Unit tests passed

Tested against VyOS versions:

  • 1.5.x

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the ansible sanity and unit tests
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added unit tests to cover my changes
  • I have added a file to changelogs/fragments to describe the changes

Copilot AI balanced review requested due to automatic review settings November 8, 2026 23:59
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@mergify mergify Bot added the invalid-body label Nov 9, 2026
@mergify mergify Bot assigned omnom62 Nov 9, 2026
@mergify mergify Bot removed the invalid-body label Nov 9, 2026
@omnom62 omnom62 changed the title T9431: vyos_bgp_address_family - ipv4-vpn/ipv6-vpn neighbor address families T9431: vyos_bgp_address_family - multiple mods (see the description) Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new pre-1.4 rejection branch lacks regression coverage for both VPN AFIs, leaving the intended failure behavior and version message unverified.

1 open issue
What changed in this PR

This PR adds IPv4 and IPv6 VPN neighbor address-family support to vyos_bgp_address_family, enabling L3VPN route-reflector configuration on VyOS 1.4 and later.

Changes:

  • Accepts, renders, and parses ipv4-vpn and ipv6-vpn, with a version guard for older devices.
  • Ignores unsupported neighbor address families during parsing.
  • Updates documentation and adds unit and integration coverage for VPN configuration.
File Description
tests/​unit/​modules/​network/​vyos/​test_vyos_bgp_address_family14.py Adds VPN rendering and parsing tests.
tests/​integration/​targets/​vyos_bgp_address_family/​tests/​cli/​merged.yaml Tests VPN merging, facts, and idempotence.
plugins/​modules/​vyos_bgp_address_family.py Documents the new neighbor AFI choices.
plugins/​module_utils/​network/​vyos/​rm_templates/​bgp_address_family_14.py Updates neighbor command generation and parsing for VPN families.
plugins/​module_utils/​network/​vyos/​config/​bgp_address_family/​bgp_address_family.py Rejects VPN configuration on versions below 1.4.
plugins/​module_utils/​network/​vyos/​argspec/​bgp_address_family/​bgp_address_family.py Adds VPN families to accepted neighbor AFIs.
docs/​vyos.vyos.vyos_bgp_address_family_module.rst Updates the published parameter reference.
changelogs/​fragments/​t9431_bgp_address_family_fixes.yml Records VPN support and the unsupported-family parsing fix.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 05:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An omitted address family with existing options remains activated after the first replaced or overridden run, requiring a second identical run to reach the desired state.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Delete omitted address families in a single run

plugins/​module_utils/​network/​vyos/​config/​bgp_address_family/​bgp_address_family.py:326

Restricting this deletion to AFI-only entries makes replaced and overridden require two runs when an omitted family currently has options. For example, replacing an IPv4 family with nexthop_self: true by an IPv6-only configuration first deletes just nexthop-self, leaving IPv4 activated; the next identical run then deletes the bare IPv4 family through this branch. Delete the whole family whenever it is absent from the desired neighbor's address families, and skip its leaf comparisons, so the first run reaches the desired state.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 07:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Legacy VyOS handling generates an invalid delete path when removing default-originate and incorrectly renders default_originate: true as a route-map reference rather than enabling plain default origination.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +109 to +110
- C(ipv4) and C(ipv6) are the unicast address families (C(ipv4-unicast), C(ipv6-unicast)),
C(ipv4-vpn) and C(ipv6-vpn) the L3VPN ones.
Comment on lines +120 to +122
if vpn and LooseVersion(get_os_version(self._module)) < LooseVersion("1.4"):
self._module.fail_json(
msg="address family {0} needs VyOS 1.4 or later".format(", ".join(vpn)),

from __future__ import absolute_import, division, print_function


Copilot AI balanced review requested due to automatic review settings November 19, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The raw default_originate formatter coerces route-map names such as True and 123 into non-string values in both templates, conflating named and bare origination and causing repeated updates.

4 open issues

Review effort: Balanced

"{{ afi }}": {
"afi": "{{ afi }}",
"default_originate": "{{ map }}",
"default_originate": "{{ map if map is defined else True }}",
@omnom62 omnom62 added legacy Exempt from per-commit T-ID check (title T-ID still required); grandfathered PRs and removed invalid-task-id labels Nov 19, 2026
Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +101 to +102
if value is False:
af.pop("default_originate")
# (default-originate route-map <name>); false means not configured.
for neighbor in self.want.get("neighbors", []):
for af in neighbor.get("address_family", []):
value = af.get("default_originate")
"{{ afi }}": {
"afi": "{{ afi }}",
"default_originate": "{{ map }}",
"default_originate": "{{ map if map is defined else True }}",
Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
},
"default_originate": {"type": "str"},
"default_originate": {"type": "raw"},
Comment on lines +275 to +278
if set(af_entry) == {"afi"} and not hneigh.get(name, {}).get(
"address_family",
{},
).get(afi):
Copilot AI balanced review requested due to automatic review settings November 23, 2026 22:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

legacy Exempt from per-commit T-ID check (title T-ID still required); grandfathered PRs

Development

Successfully merging this pull request may close these issues.

2 participants