Skip to content

Add UpperRegionalHub BGP anchor-prefix and table-map tests - #26892

Open
narasim-microsoft wants to merge 1 commit into
sonic-net:masterfrom
narasim-microsoft:narasimhang/urh-anchor-prefix-tests
Open

Add UpperRegionalHub BGP anchor-prefix and table-map tests#26892
narasim-microsoft wants to merge 1 commit into
sonic-net:masterfrom
narasim-microsoft:narasimhang/urh-anchor-prefix-tests

Conversation

@narasim-microsoft

Copy link
Copy Markdown
Contributor

Description of PR

Adds three test files exercising the ANCHOR_PREFIX / SELECTIVE_ROUTE_DOWNLOAD table-map mechanism for the UpperRegionalHub device type. These complement the sonic-buildimage code change in sonic-net/sonic-buildimage#28893 (adds UpperRegionalHub to the ANCHOR_PREFIX allowlist and SELECTIVE_ROUTE_DOWNLOAD table-map condition).

  • tests/bgp/test_urh_anchor_prefix.py: end-to-end DUT-local verification of the ANCHOR_PREFIX CONFIG_DB -> BGP table-map -> community-tagged aggregate route pipeline for UpperRegionalHub. On topologies where the static minigraph-driven general/peer-group.conf.j2 template doesn't render (e.g. dynamic-neighbor KVM t0), falls back to applying the equivalent route-maps directly via vtysh so the underlying bgpcfgd production code path is still exercised end-to-end.
  • tests/bgp/test_bgp_table_map.py: generic, parametrized FIB-filtering tests across multiple device types (UpperSpineRouter, UpperRegionalHub) validating that table-map suppression only removes routes from the FIB while the BGP RIB retains them.
  • tests/bgp/test_bgp_table_map_device_type.py: device-type gating test confirming the table-map is rendered only for device types where it's expected (SpineRouter+UpstreamLC, UpperSpineRouter, UpperRegionalHub) and absent otherwise.

These tests are topology-agnostic (t0, t1, t2, lrh, urh, any).

Depends on

How did you do it

Verified via flake8 (clean) and pytest --collect-only (fails identically to pre-existing test files without a live --testbed/--testbed-file, confirming no import/collection issues specific to these new files).

How did you verify/test it

Marking as draft pending: (1) sonic-buildimage#28893 merging, (2) a full run against a deployed KVM testbed with a UpperRegionalHub DUT.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

# Helpers
# ============================================================

def get_anchor_community(duthost):
duthost.shell("docker exec bgp vtysh {}".format(cmd_args))


def get_bgp_asn(duthost):
Add three test files exercising the ANCHOR_PREFIX/SELECTIVE_ROUTE_DOWNLOAD
table-map mechanism for the UpperRegionalHub device type, complementing
the corresponding sonic-buildimage allowlist/table-map changes:

- test_urh_anchor_prefix.py: end-to-end DUT-local verification of the
  ANCHOR_PREFIX CONFIG_DB -> BGP table-map -> community-tagged aggregate
  route pipeline for UpperRegionalHub. On topologies where the static
  minigraph-driven general/peer-group.conf.j2 template doesn't render
  (e.g. dynamic-neighbor KVM t0), falls back to applying the equivalent
  route-maps directly via vtysh so the underlying bgpcfgd production
  code path is still exercised end-to-end.
- test_bgp_table_map.py: generic, parametrized FIB-filtering tests across
  multiple device types (UpperSpineRouter, UpperRegionalHub) validating
  that table-map suppression only removes routes from the FIB while the
  BGP RIB retains them.
- test_bgp_table_map_device_type.py: device-type gating test confirming
  the table-map is rendered only for device types where it's expected
  (SpineRouter+UpstreamLC, UpperSpineRouter, UpperRegionalHub) and absent
  otherwise.

These tests are topology-agnostic (t0, t1, t2, lrh, urh, any) and exercise
the same bgpcfgd/PrefixListMgr and FRR template code paths introduced in
sonic-buildimage PR #28893 (add UpperRegionalHub to the ANCHOR_PREFIX
allowlist and SELECTIVE_ROUTE_DOWNLOAD table-map condition).

Note: the UpperRegionalHub-specific paths in these tests depend on
sonic-buildimage PR #28893 landing; until then, DUTs built from current
master will not have gained ANCHOR_PREFIX/table-map support for this
device type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Narasimhan Ganapathiraman <narasimhang@microsoft.com>
@narasim-microsoft
narasim-microsoft force-pushed the narasimhang/urh-anchor-prefix-tests branch from 2874e84 to 01049cb Compare August 7, 2026 22:36
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@narasim-microsoft
narasim-microsoft marked this pull request as ready for review August 7, 2026 22:38
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants