Repository navigation
Conversation
Pin the public OpenConfig 5.11 global-filter regeneration and use typed policy configuration, deletion and CONFIG/STATE reads. Preserve batching, Cisco JSON_IETF encoding and fresh reconnect transports. Include the wire-contract check and Jenkins reproduction instructions. AFT-6.1 passed all seven groups and four prefix variants from the prepared public checkout; all four AFT binaries compiled.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request completes the migration of AFT filtered-streaming tests to use typed Ondatra OpenConfig bindings. It carries forward critical filtering fixes required for Cisco IOS XR, ensuring consistent test behavior across vendors. The changes include updated test implementations, shared collector improvements, and robust diagnostic capabilities to facilitate future debugging and validation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request transitions the AFT prefix filtering tests (AFT-6.1 through AFT-6.4) to use typed Ondatra and ygnmi bindings instead of raw gNMI paths. It introduces platform exceptions and robust diagnostic helpers to accommodate Cisco IOS XR limitations, such as replacing complete prefix-sets and using BGP-origin AFT summaries for VRF convergence. The review feedback highlights critical improvements: replacing t.Logf calls in asynchronous background goroutines within aft_cache.go to prevent flaky test panics, and replacing several usages of context.Background() with t.Context() in gNMI operations to ensure proper timeout and cancellation handling.
| if err != nil { | ||
| counters.receiveFailure.Store(&aftSubscriptionResponse{err: err}) | ||
| if ctx.Err() == nil { | ||
| // Record the client queue at the actual receive failure, | ||
| // before its error waits behind any buffered notifications. | ||
| // This is not the DUT's MDT destination queue. | ||
| t.Logf("DUT %s NI=%s AFT stream receive failed UTC=%s: %v; CLIENT buffered notifications=%d/%d received=%d processed=%d (not the DUT queue)", | ||
| dut.Name(), networkInstance, time.Now().UTC().Format(time.RFC3339Nano), err, | ||
| len(buffer), cap(buffer), counters.received.Load(), counters.processed.Load()) | ||
| select { | ||
| case buffer <- &aftSubscriptionResponse{err: err}: | ||
| case <-ctx.Done(): | ||
| } | ||
| } | ||
| return | ||
| } | ||
| counters.received.Add(1) | ||
| counters.lastReceived.Store(time.Now().UnixNano()) | ||
| if n.GetSyncResponse() { | ||
| counters.syncReceived.Add(1) | ||
| t.Logf("DUT %s gNMI AFT SyncResponse arrived; buffered notifications=%d/%d", | ||
| dut.Name(), len(buffer), cap(buffer)) | ||
| } |
There was a problem hiding this comment.
Calling t.Logf inside an asynchronous background goroutine is a known anti-pattern in Go tests. If the test finishes or is cancelled while the background goroutine is still receiving messages or handling errors, calling t.Logf will cause a panic (testing: t.Logf called after Test... has finished), leading to flaky test failures. Since these events are already logged or tracked via ss.Progress() and ListenUntil, we should safely remove these asynchronous logging calls.
if err != nil {
counters.receiveFailure.Store(&aftSubscriptionResponse{err: err})
if ctx.Err() == nil {
select {
case buffer <- &aftSubscriptionResponse{err: err}:
case <-ctx.Done():
}
}
return
}
counters.received.Add(1)
counters.lastReceived.Store(time.Now().UnixNano())
if n.GetSyncResponse() {
counters.syncReceived.Add(1)
}| t.Logf("Sending typed AFT global-filter Set batch: %s", batch) | ||
| started := time.Now() | ||
| t.Logf("AFT global-filter Set start: UTC=%s NI=%s client=%p createdUTC=%s", started.UTC().Format(time.RFC3339Nano), cfg.VRFName, client, createdAt.UTC().Format(time.RFC3339Nano)) | ||
| response, err := batch.Set(context.Background(), typedClient, ygnmi.WithEncoding(ConfigEncoding(dut))) |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| response, err := batch.Set(context.Background(), typedClient, ygnmi.WithEncoding(ConfigEncoding(dut))) | |
| response, err := batch.Set(t.Context(), typedClient, ygnmi.WithEncoding(ConfigEncoding(dut))) |
| batch := &ygnmi.SetBatch{} | ||
| ygnmi.BatchDelete(batch, filter.Ipv4Policy().Config()) | ||
| ygnmi.BatchDelete(batch, filter.Ipv6Policy().Config()) | ||
| _, err = batch.Set(context.Background(), client) |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| _, err = batch.Set(context.Background(), client) | |
| _, err = batch.Set(t.Context(), client) |
| req := &gpb.SetRequest{Update: updates} | ||
| _, setErr := client.Set(context.Background(), req) | ||
| t.Logf("Sending typed AFT global-filter negative-check Set batch: %s", batch) | ||
| _, setErr := batch.Set(context.Background(), client, ygnmi.WithEncoding(aftpf.ConfigEncoding(dut))) |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| _, setErr := batch.Set(context.Background(), client, ygnmi.WithEncoding(aftpf.ConfigEncoding(dut))) | |
| _, setErr := batch.Set(t.Context(), client, ygnmi.WithEncoding(aftpf.ConfigEncoding(dut))) |
| } | ||
| req := &gpb.SetRequest{Delete: []*gpb.Path{policyDefinitionPath(policyName)}} | ||
| t.Logf("Sending policy-definition delete gNMI SetRequest: %v", req) | ||
| _, setErr := client.Set(context.Background(), req) |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| _, setErr := client.Set(context.Background(), req) | |
| _, setErr := client.Set(t.Context(), req) |
| ygnmi.BatchDelete(batch, filter.Ipv4Policy().Config()) | ||
| ygnmi.BatchDelete(batch, filter.Ipv6Policy().Config()) | ||
| ygnmi.BatchDelete(batch, gnmi.OC().RoutingPolicy().PolicyDefinition(policyName).Config()) | ||
| if _, err := batch.Set(context.Background(), client); err != nil { |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| if _, err := batch.Set(context.Background(), client); err != nil { | |
| if _, err := batch.Set(t.Context(), client); err != nil { |
| if _, err := client.Set(context.Background(), req); err != nil { | ||
| started := time.Now() | ||
| t.Logf("Sending prefix-set reference gNMI SetRequest UTC=%s: %v", started.UTC().Format(time.RFC3339Nano), req) | ||
| response, setErr := client.Set(context.Background(), req) |
There was a problem hiding this comment.
Using context.Background() for gNMI operations in tests can cause the test to hang indefinitely if the gNMI server blocks or fails to respond. Since t.Context() is available, we should use it to ensure proper cancellation and timeout handling when the test finishes or is interrupted.
| response, setErr := client.Set(context.Background(), req) | |
| response, setErr := client.Set(t.Context(), req) |
Recognize TenGigE as Te in the strict native IPv6 ND fallback and add parser regression coverage. Poll AFT-6.3 collector conditions every five seconds so initial sync cannot race its two-minute deadline. Preserve exact peer identity, existing deadlines and forwarding assertions.
Recognize XR's Hu abbreviation while preserving the existing Te/FH mappings and exact address, full port suffix and MAC validation. Add eight HundredGigE regression cases alongside the thirteen existing parser cases; update the reproduction note.
Updates AFT-6.1–6.4 for Cisco IOS XR and replaces handwritten global-filter configuration and readback with generated Ondatra bindings.
Shared changes address notification deletion handling and Cisco VRF next-hop scoping. The public B4FireX Ondatra dependency supplies the OpenConfig 5.11 global-filter bindings. Requires Go 1.26.3.
Validation
All four suites compiled. Binding-contract checks and 26 focused regression cases passed. Earlier SIM runs used the external B4 timing overlay.