Skip to content

Adding acctz-6.1 test case#5298

Open
mihaitomaro wants to merge 1 commit intoopenconfig:mainfrom
open-traffic-generator:otg-acctz-6.1
Open

Adding acctz-6.1 test case#5298
mihaitomaro wants to merge 1 commit intoopenconfig:mainfrom
open-traffic-generator:otg-acctz-6.1

Conversation

@mihaitomaro
Copy link
Copy Markdown
Contributor

No description provided.

@mihaitomaro mihaitomaro requested a review from a team as a code owner April 3, 2026 12:56
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a new automated test case for the GNSI Acctz service. The purpose of this test is to ensure that the system correctly terminates the RecordSubscribe stream after an idle timeout period, validating the expected behavior of the device under test.

Highlights

  • New Test Case: Added a new test case to verify that the GNSI Acctz RecordSubscribe stream correctly handles idle timeouts.
  • Infrastructure: Implemented CLI-based configuration for the GNSI service to support the new test environment.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@OpenConfigBot
Copy link
Copy Markdown

Pull Request Functional Test Report for #5298 / 1b399d2

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Cisco 8000E status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Cisco XRd status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Juniper ncPTX status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Nokia SR Linux status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Openconfig Lemming status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Cisco 8808 status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Juniper PTX10008 status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client
Nokia 7250 IXR-10e status
status
ACCTZ-5.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - client becomes silent
ACCTZ-6.1: gNSI.acctz.v1 (Accounting) Test RecordSubscribe Idle Timeout - DoA client

Help

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Go test for gNSI Acctz RecordSubscribe idle timeout functionality. The test aims to verify that the DUT closes the stream after an idle period. Review feedback highlights several issues: the client-side context timeout is currently shorter than the test's wait period, potentially causing false positives by timing out before the DUT; codes.DeadlineExceeded should not be considered an expected stream closure error as it indicates a client-side timeout; and the error from time.Parse for the system timestamp is ignored, which could lead to unexpected behavior.


systemTime := gnmi.Get(t, dut, gnmi.OC().System().CurrentDatetime().State())
startTime, _ := time.Parse(time.RFC3339, systemTime)
ctx, cancel := context.WithTimeout(t.Context(), defaultIdleTimeout)
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.

high

The context timeout is set to defaultIdleTimeout (120s), but the test later sleeps for defaultIdleTimeout + gracePeriod (180s) at line 73. This causes the client-side context to expire before the sleep finishes, meaning Recv() at line 76 will always return context.DeadlineExceeded. This results in a false positive because the test isn't actually waiting for the DUT to close the connection; it's just hitting its own timeout. The context timeout should be significantly longer than the total wait time to ensure the DUT is the one initiating the closure.

Suggested change
ctx, cancel := context.WithTimeout(t.Context(), defaultIdleTimeout)
ctx, cancel := context.WithTimeout(t.Context(), defaultIdleTimeout+gracePeriod+30*time.Second)
References
  1. In tests that inject artificial latency, convergence timeouts must be sufficiently long to account for the added delay and prevent premature test failure.

}
if st, ok := status.FromError(err); ok {
switch st.Code() {
case codes.Canceled, codes.Unavailable, codes.DeadlineExceeded:
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.

medium

codes.DeadlineExceeded should be removed from the list of expected stream closure errors. If the RPC returns DeadlineExceeded, it indicates that the client-side context expired before the DUT closed the connection, which should be treated as a test failure (i.e., the DUT did not time out the idle session as expected).

Suggested change
case codes.Canceled, codes.Unavailable, codes.DeadlineExceeded:
case codes.Canceled, codes.Unavailable:

// acctz.SetupUsers(t, dut, false)

systemTime := gnmi.Get(t, dut, gnmi.OC().System().CurrentDatetime().State())
startTime, _ := time.Parse(time.RFC3339, systemTime)
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.

medium

The error from time.Parse is ignored. If the DUT returns a timestamp in a non-RFC3339 format, startTime will be the zero value, which could lead to an invalid RecordRequest or unexpected DUT behavior. Use t.Errorf to report the error while allowing the test to continue.

Suggested change
startTime, _ := time.Parse(time.RFC3339, systemTime)
startTime, err := time.Parse(time.RFC3339, systemTime)
if err != nil {
t.Errorf("Failed to parse system time %q: %v", systemTime, err)
}
References
  1. In tests, prefer using t.Errorf over t.Fatalf to allow the test to run to completion and report all potential errors, rather than exiting on the first failure.

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.

2 participants