Skip to content

Refine routing control-plane participation semantics#552

Closed
zzw4257 wants to merge 11 commits into
developmentfrom
pr/routing-control-plane-participation
Closed

Refine routing control-plane participation semantics#552
zzw4257 wants to merge 11 commits into
developmentfrom
pr/routing-control-plane-participation

Conversation

@zzw4257

@zzw4257 zzw4257 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR implements the first routing-control-plane evolution slice on top of the latest development branch. The goal is to make SEED express a key control-plane question more explicitly:

after edge routers learn external routes through eBGP, which routers inside the AS should participate in carrying those BGP routes?

The legacy behavior is preserved by default. New realism-oriented behavior is opt-in and built around explicit participation, router roles, and shared routing metadata, so existing IPv4/BIRD examples keep their historical semantics while larger or higher-fidelity topologies can avoid making every internal router an iBGP participant.

Why

The previous default iBGP model was convenient for examples, but too implicit for realistic transit networks: every internally reachable router could be pulled into full-mesh iBGP. That means core routers can end up carrying BGP external routes even when the intended design is edge-only iBGP, route reflection, explicit peering, or MPLS-style core isolation.

This PR does not replace the old model. It turns the old model into an explicit compatibility mode and adds the APIs needed for new examples and benchmark topologies to state their routing intent precisely.

Key Changes

Router role hints

  • Adds Router.setControlPlaneRole("edge|core|rr|rr-client").
  • Adds Router.getControlPlaneRole().
  • Adds Router.disableControlPlane("ibgp") for per-router participation exclusion.
  • Exposes role/disable state through labels for review and generated metadata visibility.
  • Role hints do not change legacy behavior by themselves.

iBGP participation modes

Ibgp() still defaults to the historical full-mesh behavior.

New opt-in AS modes:

  • legacy-full-mesh: existing behavior, preserved as the default.
  • edge-full-mesh: only declared participants or routers with role edge participate.
  • route-reflector: only explicit cluster/RR members participate; unclustered core routers do not silently join.
  • explicit: only declared addSession() pairs render iBGP sessions.
  • disabled: disables iBGP for the AS, aligned with existing masking semantics.

All generated sessions still go through _bgp_metadata.install_router_bgp_session(), and Routing remains responsible for rendering BIRD/FRR config.

OSPF classification mode

Adds opt-in Ospf.setAsMode(asn, "router-transit-only"):

  • router-router Local networks become active OSPF interfaces;
  • host-facing Local networks become passive;
  • explicit markAsStub() and maskNetwork() keep priority;
  • default legacy OSPF behavior is unchanged.

This keeps OSPF focused on internal reachability while avoiding noisy active OSPF on host-facing networks in new realistic examples.

Explicit eBGP IX router selection

Adds APIs for multi-router IX topologies:

  • Ebgp.addPrivatePeeringByRouters(ix, a, aRouter, b, bRouter, ...)
  • Ebgp.addRsPeerByRouter(ix, peer, routerName)
  • Optional router selection on existing addPrivatePeering(..., aRouter=..., bRouter=...) and addRsPeer(..., routerName=...).

The old API path still resolves the first matching IX router for backward compatibility. The new APIs make the intended edge router explicit when an AS has multiple routers connected to the same IX.

MPLS BGP intent convergence

  • Keeps existing MPLS runtime behavior and edge detection.
  • Moves MPLS edge-only iBGP session recording from direct BIRD protocol writes to shared BGP metadata.
  • Leaves MPLS LDP/OSPF rendering inside Mpls for this PR; full MPLS renderer migration is intentionally out of scope.

Compileall cleanup

  • Renames the Ethereum utility setup template from .py to .sh and updates the template loader.
  • The generated container path was already utility_server_setup.sh; this only prevents python -m compileall seedemu from trying to compile a bash script.

Design Boundaries

This PR intentionally does not:

  • redistribute external BGP routes into OSPF by default;
  • change eBGP relationship policy;
  • make ExaBGP a router backend;
  • change IPv4/BIRD default behavior;
  • implement address-family-aware IPv6 BGP/OSPF intent;
  • fully migrate MPLS LDP/OSPF rendering into Routing.

Those are separate design slices. This PR focuses on participation semantics and safe intent convergence.

Compatibility Notes

  • Existing Ibgp() behavior remains legacy full mesh.
  • Existing Ospf() behavior remains legacy broad Local-network OSPF.
  • Existing Ebgp.addPrivatePeering() and addRsPeer() continue to work without new arguments.
  • Router role hints only affect new opt-in iBGP modes.
  • BIRD/FRR rendering still happens through Routing from shared metadata.

Validation

Local validation completed:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /tmp/seedemu-routing-system-venv/bin/python -m pytest -q test_frr_exabgp_foundation.py
# 26 passed

python3 -m compileall seedemu test_frr_exabgp_foundation.py
# passed; only pre-existing SyntaxWarning messages

git diff --check origin/development...HEAD
# passed

/tmp/seedemu-routing-system-venv/bin/python -m seedemu.testing.cli compile examples/basic/A00_simple_as/example.yaml
# passed

/tmp/seedemu-routing-system-venv/bin/python -m seedemu.testing.cli compile examples/basic/A12_bgp_mixed_backend/example.yaml
# passed

/tmp/seedemu-routing-system-venv/bin/python -m seedemu.testing.cli compile examples/basic/A14_control_plane_regression/example.yaml
# passed

/tmp/seedemu-routing-system-venv/bin/python - <<'PY'
from seedemu.services.EthereumService.EthTemplates.EthServerFileTemplates import UtilityServerFileTemplates
assert UtilityServerFileTemplates['server_setup'].startswith('#!/bin/bash')
assert 'python3 ./fund_account.py' in UtilityServerFileTemplates['server_setup']
assert 'python3 ./deploy_contract.py' in UtilityServerFileTemplates['server_setup']
print('ethereum utility template import ok')
PY
# passed

Review Focus

Recommended review order:

  1. seedemu/layers/Ibgp.py: default compatibility and new participation modes.
  2. seedemu/core/Node.py: router role and per-router iBGP disable API.
  3. seedemu/layers/Ebgp.py: explicit IX router selection without breaking legacy selection.
  4. seedemu/layers/Ospf.py: opt-in router-transit-only classification.
  5. seedemu/layers/Mpls.py: BGP intent moved into shared metadata while LDP/OSPF remains scoped to MPLS.
  6. test_frr_exabgp_foundation.py: behavior-level guard tests for default compatibility and new modes.

@kevin-w-du kevin-w-du closed this Jun 18, 2026
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