Skip to content

Add BGP peer and route flap control operations - #485

Open
atul-nexthop wants to merge 2 commits into
open-traffic-generator:masterfrom
atul-nexthop:atul.bgp-flap
Open

atul-nexthop wants to merge 2 commits into
open-traffic-generator:masterfrom
atul-nexthop:atul.bgp-flap

Conversation

@atul-nexthop

@atul-nexthop atul-nexthop commented Jul 9, 2026 •

Copy link
Copy Markdown

Addresses #484

What this adds

On-the-fly flap operations (start/stop while the session is up, no config change), per the requirements in #484:

  • action.protocol.bgp.peer.flap — flap BGP peer sessions.
  • action.protocol.bgp.route.flap — flap BGP route ranges.

Design

Flapping is only supported on BGP peers and route ranges in IxNetwork; ISIS/OSPF route ranges have no flap fields (only a static Active flag). So both flap operations are modeled BGP-scoped under Action.Protocol.Bgp, alongside notification and initiate_graceful_restart:

  • Action.Protocol.Bgp.Peer.Flap — peer_names (BGP peers), enable, up_time, down_time.
  • Action.Protocol.Bgp.Route.Flap — route_names (BGP v4/v6 route ranges), enable, up_time, down_time, plus the extra route-range controls IxNetwork exposes:
    • delay — delay (seconds) before flapping begins.
    • partial_flap — flap only a subset of the routes within each range.
    • flap_from_route_index / flap_to_route_index — inclusive index window for the subset when partial_flap is enabled.

Flap is a triggered operation with timing, which fits the action scope per control/readme.md (states are representable purely by enums; actions are triggers). x-field-uids are appended so existing fields are untouched. Both new operations are marked x-status: under_review.

Note on scope (changed from the earlier revision of this PR)

Route flap was initially placed on the generic State.Protocol.Route (cross-protocol via its x-constraint). That advertised a flap capability for ISIS/OSPF that the backend can't honor, and the extra fields (partial_flap, flap_from/to_route_index) are BGP-route-range specific. It has been moved to action.protocol.bgp.route.flap and removed from State.Protocol.Route (which keeps names + state withdraw/advertise, honored by BGP/ISIS/OSPF via Active).

Files

  • control/bgp.yaml, control/protocol.yaml (source)
  • artifacts/openapi.yaml, artifacts/otg.proto (regenerated via build.py)

Testing

  • python build.py passes (openapiart validation green).

- action.protocol.bgp.peer.flap: flap BGP peer sessions on the fly
- state.protocol.route.flap: flap routes (generic - BGP/ISIS/OSPF) on the fly

Both are enable/up_time/down_time toggles, marked x-status under_review.
Regenerate artifacts (openapi.yaml, otg.proto).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@atul-nexthop

Copy link
Copy Markdown
Author

@apratimmukherjee @sasubrata this implements #484 — on-the-fly flap for BGP peers and routes. I've raised it as a proposal and I'm happy to adjust the modeling to fit the project's conventions. Could you take a look or assign a reviewer when you have a chance? Thanks!

@apratimmukherjee
apratimmukherjee self-requested a review July 9, 2026 16:08
@apratimmukherjee

apratimmukherjee commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

@atul-nexthop Thanks for raising this — appreciate the initiative on both the issue and the PR.

I want to check this against a related ask: I was forwarded an email thread describing a need to not auto-advertise routes on session up, and instead control route transmission (and flapping) explicitly from the test.

Could you clarify whether this PR is:

An additional requirement — i.e., flap control exposed via the API itself, rather than driven from test code (e.g., a loop issuing adv/withdraw), or
Related to the same need described in that email thread?
That'll help us figure out whether this should land together with the session-bringup/route-advertisement separation work, or as its own item — will follow up once we hear back. Thanks!

@atul-nexthop

atul-nexthop commented Jul 9, 2026 •

Copy link
Copy Markdown
Author

I want to check this against a related ask: I was forwarded an email thread describing a need to not auto-advertise routes on session up, and instead control route transmission (and flapping) explicitly from the test.

@apratimmukherjee Thank you for your quick response.

This is separate task from the one raised via support team.

  • So the first ask which was raised via support team, It was ability to bifurcation of the route advertisement or withdrawl from BGP session establishment - currently, The routes are auto advertised when session comes up - The specific use for this is to allow us to measure route programing learning capability.
  • The ask in this PR is separate - We would like the ability to set the flap and timers via api - If you refer to the screenshot attached on this Issue description - IXIA already has flap parameter in BGP Peer and BGP route ranges - so, This PR is to allow us ability to set those so specific routes are only flapped allowing us better control over flap timers as well.

Please let me know if this makes sense.

Route flap was modeled on the generic State.Protocol.Route, but only BGP
route ranges support flapping in IxNetwork (ISIS/OSPF route ranges have no
flap fields, only a static Active flag). Move route flap to a BGP-scoped
action so the schema only advertises what the backend can honor.

- Remove flap from generic State.Protocol.Route (keeps names + state,
  honored by BGP/ISIS/OSPF via Active).
- Add action.protocol.bgp.route.flap alongside action.protocol.bgp.peer.flap.
- Add route-range flap fields confirmed in restpy: delay, partial_flap,
  flap_from_route_index, flap_to_route_index (plus enable/up_time/down_time).

Regenerate artifacts (openapi.yaml, otg.proto).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@atul-nexthop

atul-nexthop commented Sep 1, 2026 •

Copy link
Copy Markdown
Author

@apratimmukherjee @indraniBh @kamalsahu0001 I would appreciate your help on this if these fields can be exposed on OTG and allows us to set these using snappi.

if you would like me to open a support ticket - please let me know

@indraniBh

Copy link
Copy Markdown
Contributor

@atul-nexthop :
We are working on a script-based approach and will share an update soon.

One point worth highlighting is that the background thread mechanism would only be required if this verification needs to run asynchronously in the background. Otherwise, the same behavior can be implemented in a straightforward manner as a direct library function/wrapper.

We are leaning toward a library-based solution rather than introducing a new OTG API for a couple of reasons:

  1. Keeping OTG vendor-neutral and the API surface simple:
    OTG aims to remain vendor-neutral and provide an extensible toolkit. In general, if a requirement can be addressed through a library wrapper built on top of existing APIs, we prefer that approach over adding new protocol-specific APIs. This helps keep the core API surface easier to understand, implement, and maintain across vendors.
  2. Avoiding overlap with existing capabilities:
    In this case, introducing a dedicated API could potentially overlap with existing route advertise/withdraw APIs as well as APIs already available for stopping/restarting specific BGP peers. Those primitives can be combined as needed and triggered based on custom verification logic implemented in the wrapper layer.
    An additional benefit of this approach is that it remains generic and can be applied to other protocols (for example, OSPFv2/v3 and ISIS) that may require similar verification workflows, without introducing protocol-specific APIs or requiring additional implementation and validation effort across all supported implementations.

We are putting together this approach and will update the thread shortly.

@atul-nexthop

Copy link
Copy Markdown
Author

Thanks @indraniBh — and I appreciate you working up a concrete approach. I agree with both goals: keep OTG vendor-neutral, and don't add API surface where existing primitives compose. Before the script lands, two things I'd ask you to weigh, because I don't think a wrapper can cover them.

1. Call volume, and the robustness that follows from it. With engine-driven flap the test makes two calls total — start with the up/down timers, stop when done — and the chassis runs the pattern itself. A wrapper makes two calls per flap cycle, so the count scales with duration and flap rate: a 10-minute run at a 1-second period is ~1,200 REST calls instead of 2, and a longer or faster test multiplies from there.

That has two consequences. The obvious one is load — those calls land on a shared API server that other sessions and other teams are using at the same time. The one that worries me more is fidelity: every transition depends on that path staying healthy for the whole run, so the flap pattern degrades exactly when the controller is busiest, which on a scale test is precisely when the flap is running. The stimulus the test asked for stops being the stimulus the DUT sees, and a flap test is only meaningful if the stimulus is known and repeatable. Is that something the wrapper approach can guarantee?

2. Partial flap. partial_flap with flap_from_route_index/flap_to_route_index flaps a subset within a route range. Advertise/withdraw works at range granularity, so a wrapper would have to split the range into separate ranges — which changes the configuration under test and invalidates what's being measured.

On genericity — I think we want the same thing. An earlier revision of this PR put flap on the generic State.Protocol.Route, cross-protocol. I moved it to BGP scope only because ISIS/OSPF expose a static Active flag and can't honour flap, and I didn't want to advertise a capability backends can't deliver.

If the concern is protocol-specific surface, I'm happy to move it back to a generic route/protocol scope with capability reporting, so unsupported backends report unsupported rather than silently no-op. That gives one operation instead of per-protocol APIs, addresses the overlap concern, and keeps the engine-side execution a wrapper can't provide.

Happy to revise the PR that way, or to review your script against these two cases once it's up.

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