Skip to content

gNOI-5.4: Add test code for gNOI File Put and Stat Protocol Conformance - #6313

Open
rakvishwakarma wants to merge 3 commits into
openconfig:mainfrom
rakvishwakarma:b_579093486_gnoi_5_4_code
Open

rakvishwakarma wants to merge 3 commits into
openconfig:mainfrom
rakvishwakarma:b_579093486_gnoi_5_4_code

Conversation

@rakvishwakarma

Copy link
Copy Markdown

This pull request adds the Go test code for gNOI-5.4 (gNOI File Put and Stat Protocol Conformance), following the README-only test plan in #6270.

Depends on #6270. This branch is stacked on the #6270 commit, so that commit also appears here until #6270 merges; after that, this PR contains only the test code changes below.

What's included

  • Test code – gnoi_file_conformance_test.go, implementing gNOI-5.4.1 through gNOI-5.4.5 from the README.
  • Metadata – platform_exceptions (deviations) in metadata.textproto.
  • Test registry – adds the exec link to the gNOI-5.4 entry.

Review comments addressed

  • Scratch directory paths: a scratch directory ending in ":" (for example "harddisk:") is now joined with the file name as "harddisk:<name>" instead of path.Join's "harddisk:/<name>".
  • Hex digest validation: verifyErrorDigestHex now checks every standalone hex token of 16 or more characters (\b(?:0[xX])?([0-9a-fA-F]{16,})\b), so omitted leading zeros are caught even when other words appear between "hash" and the hex value.
  • RPC contexts: rpcContext returns (context.Context, context.CancelFunc) and every call site defers cancel() (unary calls through small statFile / removeFile / transferToRemote helpers, and looped streams through putInvalidRemoteFile / getFileError), instead of registering t.Cleanup(cancel) for every RPC.

Other change

  • On platforms that reuse an existing loopback subinterface, the interface type (softwareLoopback) is now always sent, because some platforms reject an interface update without it. description and enabled are still left untouched on a reused loopback; the configuration sent to other platforms is unchanged.

Implementation notes

  • Every gNOI File RPC is limited to 2 minutes, so a DUT that never responds fails the step instead of hanging the test. A client-side timeout is never treated as a valid rejection.
  • The scratch directory is resolved on the DUT with File.Stat, trying /misc/disk1, harddisk:, /tmp (default), /var/tmp, and /mnt/flash in that order.
  • A File.Stat result of UNAVAILABLE, UNIMPLEMENTED, PERMISSION_DENIED, or UNAUTHENTICATED is treated as a server or session failure, not as proof that a file is absent.
  • Only documentation IP ranges (RFC 5737 / RFC 3849) are used. Platform differences are handled only through deviations.

Test results (Nokia)

  • PASS: gNOI-5.4.1, gNOI-5.4.3 (UNSPECIFIED hash method rejection), gNOI-5.4.4, gNOI-5.4.5, and cleanup.
  • FAIL (expected): gNOI-5.4.2 and gNOI-5.4.3 (SHA-256/MD5 wrong checksum). The DUT accepts a File.Put that ends without the required hash message, and reports hash values in an incorrect hex format when rejecting a wrong checksum. These are the DUT issues this test is designed to catch.

… Put and Stat Protocol Conformance

Adds the gNOI-5.4 test plan (README.md), its metadata.textproto, and the
gNOI-5.4 testregistry entry. The Go test code and platform_exceptions will
follow in a separate PR.
Adds gnoi_file_conformance_test.go, the platform_exceptions in
metadata.textproto, and the exec link in the gNOI-5.4 testregistry entry.
Follow-up to the README-only PR openconfig#6270.

Also addresses the code review comments:
- Join a scratch directory that ends in ":" (for example "harddisk:")
  and a file name as "harddisk:<name>" instead of "harddisk:/<name>".
- Match every standalone hex token of 16+ characters when validating
  digests in File.Put hash-mismatch errors.
- Return (context.Context, context.CancelFunc) from rpcContext and defer
  cancel() at each call site instead of t.Cleanup(cancel) per RPC.
- Always send the interface type on a reused loopback, which some
  platforms require in every interface update.
@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 conformance test suite for the gNOI File service, specifically targeting the File Put and Stat protocols. The changes include the implementation of the test logic, necessary metadata for platform-specific deviations, and registration of the new test in the test registry. The suite focuses on verifying protocol adherence, error handling, and storage stability, ensuring that the DUT correctly manages file operations and telemetry reporting.

Highlights

  • gNOI File Conformance Test: Implemented comprehensive test code for gNOI-5.4 (File Put and Stat Protocol Conformance), covering mandatory hash validation, hex digest formatting, and multi-chunk scaling.
  • Robust RPC Handling: Updated RPC context management to use explicit cancellation and timeouts, ensuring the test suite remains stable and does not hang on unresponsive DUTs.
  • Improved Error and Path Validation: Enhanced hex digest validation to catch omitted leading zeros and added robust path resolution for scratch directories across different platforms.
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 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 .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 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

  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

OpenConfigBot commented Nov 23, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6313 / 4a70a9e

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Cisco 8000E status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Cisco XRd status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Juniper ncPTX status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Nokia SR Linux status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Openconfig Lemming status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Cisco status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Juniper status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance
Nokia status
gNOI-5.4: pending authorization
gNOI-5.4: gNOI File Put and Stat Protocol Conformance

Help

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

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.

Code Review

This pull request introduces a new conformance test suite for the gNOI File service (gNOI-5.4), covering file uploads, metadata retrieval, streaming downloads, negative test cases, and scale testing. The feedback highlights three key areas for improvement: optimizing the cleanup phase to run file removals concurrently using context.Background() to prevent cleanup failures on test timeouts; refining the error digest hex validation to avoid false positives from unrelated hex tokens in error messages; and fixing a bug where a partial failure in the final file removal step prematurely sets the filesRemoved flag, which bypasses the fallback cleanup and violates the mandatory state reversion rule.

…n partial Remove failure

- verifyErrorDigestHex only checks hex tokens that are likely to be the
  digest: tokens with the expected digest length, or a suffix of the
  expected or all-zero digest (omitted leading zeros). Unrelated hex
  tokens such as connection or trace IDs no longer cause failures.
- gNOI-5.4.5 Step 4 marks the test files as removed only when every
  File.Remove succeeds, so the deferred cleanup retries otherwise.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants