Skip to content

gNOI-5.4: Add README, metadata, test code, and test registry entry for gNOI File Put and Stat Protocol Conformance - #6270

Open
rakvishwakarma wants to merge 10 commits into
openconfig:mainfrom
rakvishwakarma:b_579093486_gnoi_5_4_readme
Open

rakvishwakarma wants to merge 10 commits into
openconfig:mainfrom
rakvishwakarma:b_579093486_gnoi_5_4_readme

Conversation

@rakvishwakarma

@rakvishwakarma rakvishwakarma commented Nov 11, 2026 •

Copy link
Copy Markdown

This pull request adds the gNOI-5.4 test, which checks that the DUT correctly implements the gNOI File service (Put, Stat, Get, Remove, TransferToRemote), with a focus on validating the trailing hash (checksum) sent at the end of a File.Put upload.

What's included

  • README – the test plan.
  • Test code – Go implementation of all gNOI-5.4 test cases.
  • Metadata – test metadata and deviations.
  • Test registry – adds the gNOI-5.4 entry.

What the test checks

  • gNOI-5.4.1 – Basic upload and download: Uploads small and multi-chunk (4 x 64 KB) files with SHA-256 and MD5 checksums, then confirms File.Stat and File.Get return the correct size, permissions, content, and properly formatted fixed-length hex checksums.
  • gNOI-5.4.2 – Upload without a checksum: Ends a File.Put upload without sending the final hash message. The DUT must reject it with an error, must not keep the partial file, and must leave existing files untouched.
  • gNOI-5.4.3 – Wrong or invalid checksum: Uploads files with an incorrect SHA-256/MD5 checksum and with an UNSPECIFIED hash method. The DUT must reject the upload, report correctly formatted hex values in the error (no ffffff sign-extension or dropped leading zeros), and not keep the file.
  • gNOI-5.4.4 – Multiple files: Uploads 10 more files (13 in total), checks the directory listing with File.Stat, and confirms storage telemetry reports non-zero size and available space.
  • gNOI-5.4.5 – Error handling and cleanup: Sends invalid requests (data before the open message; uploads to an empty path, a relative path, and an existing directory; and empty, relative, non-existent, or directory paths for Stat/Get/Remove/TransferToRemote) and expects errors, confirming the scratch directory stays intact. It then removes all 13 test files.

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.
  • Test files are written to a scratch directory resolved on the DUT with File.Stat, trying /misc/disk1, harddisk:, /tmp (default), /var/tmp, and /mnt/flash in that order, because some platforms allow File.Stat on /tmp but reject it as a File.Put destination.
  • MD5 checks use precomputed test values (including the 256 KB multi-chunk file).
  • 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.
  • Uses a dedicated test loopback interface and keeps the DUT's existing hostname. On platforms that reuse an existing loopback subinterface, only the test addresses are added; the loopback's interface-level settings are not changed.
  • File permissions use the gnoi/file/file.proto octal-digit encoding (for example 644), accepting the DUT's umask.
  • Cleanup is set up before any configuration change and restores the DUT to its original state.
  • Only documentation IP ranges (RFC 5737 / RFC 3849) are used.

Test results (Nokia)

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

@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 the gNOI-5.4 test plan, which defines the requirements for validating gNOI file transfer operations on a Device Under Test. The documentation covers positive end-to-end validation, negative test cases for stream handling and checksum mismatches, and multi-file scaling scenarios to ensure protocol robustness and storage telemetry accuracy.

Highlights

  • New Test Plan Documentation: Added a comprehensive README.md for the gNOI-5.4 test plan, detailing protocol conformance, hash verification, and error-handling requirements for gNOI file operations.
  • Metadata and Registry Updates: Included the necessary metadata.textproto for the new test plan and registered the gNOI-5.4 test in the central testregistry.textproto.
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. ↩

@google-cla

google-cla Bot commented Nov 11, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OpenConfigBot

OpenConfigBot commented Nov 11, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6270 / ebdad06

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 test plan and metadata for "gNOI-5.4: gNOI File Put and Stat Protocol Conformance" to validate gnoi.file.File protocol conformance, hash validation, and storage/session stability. It also registers the test in testregistry.textproto. The review feedback suggests a minor improvement in the README to use the platform-agnostic term "DUT" instead of "switch" for consistency.

@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.File service (gNOI-5.4), including detailed documentation, metadata, and a comprehensive Go test implementation covering both positive and negative scenarios for Put, Stat, Get, and Remove RPCs. The review feedback focuses on improving test efficiency and stability. Key recommendations include batching gNMI operations with gnmi.OCBatch() to avoid inefficient serial queries in a loop, adopting a guarded t.Cleanup pattern with a boolean flag to prevent redundant file removals, using the defined watchTimeout instead of a hardcoded 10-second timeout to avoid flakiness on slower platforms, and removing a redundant sign-extension check that could cause false-positive test failures.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 2 times, most recently from 8e267de to 03237e5 Compare November 11, 2026 11:40

@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 for the gnoi.file.File service (gNOI-5.4), verifying file operations (Put, Stat, Get, Remove), trailing hash validations, and storage telemetry. The feedback suggests improving the cleanup routine in revertLoopbackAndHostname to properly delete the loopback subinterface configuration if it did not exist prior to the test, rather than unconditionally deleting only the IP addresses, ensuring the DUT is restored to its exact original state.

@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), verifying file operations, stream validations, and storage telemetry. The review feedback highlights two key areas for improvement: first, refining the cleanup logic in revertLoopbackAndHostname to ensure loopback subinterfaces are properly restored or deleted depending on their index to prevent configuration leaks on shared testbeds; second, explicitly validating that the available and utilized mount-point telemetry fields are not nil to prevent masking non-compliant devices.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 2 times, most recently from 378af31 to 87f30d8 Compare November 11, 2026 13:03

@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 (gNOI-5.4) to validate the gnoi.file.File protocol, including positive, negative, and scale scenarios, along with corresponding documentation and metadata registration. The review feedback highlights three key improvement opportunities: replacing the custom MD5 implementation with the standard library crypto/md5 package, adding a safety check for empty mount point names to prevent potential runtime panics during batch queries, and ensuring the test explicitly fails if File.Stat unexpectedly succeeds with zero entries on a non-existent file.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 2 times, most recently from c328b9c to d25be47 Compare November 11, 2026 13:25

@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 (gNOI-5.4) to validate the gnoi.file.File protocol on the Device Under Test (DUT), including single-chunk and multi-chunk transfers, hash verification, and scale testing. The feedback suggests several improvements to the Go test implementation: using the standard path package instead of path/filepath for all DUT path manipulations to ensure platform-independent Unix-style paths, replacing the custom MD5 hashing implementation with the standard crypto/md5 package, and respecting the deviations.InterfaceEnabled(dut) deviation when configuring the top-level loopback interface.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 3 times, most recently from 8307d7b to ba0e6e4 Compare November 11, 2026 15:58

@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, gNOI-5.4: gNOI File Put and Stat Protocol Conformance, which validates the gnoi.file.File service's Put, Stat, Get, and Remove RPCs, hash validations, and storage mount-point telemetry. Feedback on the implementation highlights a critical issue in resolveTestLoopback where falling back to subinterface 0 on lo0 could overwrite the primary in-band management interface and disrupt connectivity; it is recommended to fall back to a safe, non-zero subinterface index like testLoopbackIndex (10) instead.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 3 times, most recently from 0896376 to 276cde8 Compare November 11, 2026 18:32

@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), validating file operations like Put, Stat, Get, and Remove, along with hash verification and negative test scenarios. The review feedback recommends replacing the custom MD5 hashing implementation with Go's standard library crypto/md5 package to enhance maintainability and performance, while updating the imports block to clean up unused dependencies.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch from 276cde8 to 744144d Compare November 12, 2026 04:04

@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.File service (gNOI-5.4), validating file operations such as Put, Stat, Get, and Remove under various positive and negative scenarios, including multi-chunk transfers, hash verification, and scale testing. The feedback highlights an improvement opportunity in the cleanup phase: rather than deleting the entire loopback interface, the test should only delete the specific subinterface created during the test to avoid disrupting shared testbed configurations.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch from 744144d to 90936bc Compare November 12, 2026 07:29

@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 the gNOI-5.4 test suite, which validates the OpenConfig gnoi.file.File protocol conformance on the Device Under Test (DUT). It includes a comprehensive test plan in README.md, the Go test implementation in gnoi_file_conformance_test.go, platform-specific metadata, and registration in testregistry.textproto. Feedback on the implementation suggests using hex.EncodeToString instead of fmt.Sprintf for a more idiomatic and efficient conversion of a byte slice to a hexadecimal string.

@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch 2 times, most recently from 1c8884a to cbcb7df Compare November 12, 2026 09:52
@rakvishwakarma rakvishwakarma changed the title gNOI-5.4: Add README and metadata for gNOI File Put and Stat Protocol Conformance gNOI-5.4: Add README, metadata, test code, and test registry entry for gNOI File Put and Stat Protocol Conformance Nov 12, 2026

@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, gNOI-5.4, to validate the gnoi.file.File service protocol conformance, including positive and negative scenarios for Put, Stat, Get, Remove, and TransferToRemote RPCs. The test is registered in testregistry.textproto and includes platform-specific deviations in metadata.textproto. Feedback on the implementation suggests improving the cleanup routine in gnoi_file_conformance_test.go to delete the entire subinterface configuration rather than just individual IP addresses when the subinterface did not exist prior to the test, preventing stale configurations on shared testbeds.

@jayakumarramisetty

Copy link
Copy Markdown
Contributor

/fptest virtual

@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 gNOI-5.4 (gNOI File Put and Stat Protocol Conformance). It includes a detailed test plan README, the Go test implementation validating positive and negative scenarios for the gNOI File service, platform-specific metadata, and registration in the test registry. The reviewer's feedback correctly identifies a potential issue in the mount point validation logic, where the test could fail on virtual or ephemeral mount points that do not report capacity metrics. The reviewer suggests skipping these unpopulated mount points instead of failing the test, which is a valuable improvement for test robustness across different platforms.

… errors

Tighten gNOI-5.4.3 so any digest rendered in a hash-mismatch error message
must be the fixed-length, zero-padded unsigned hex encoding (64 chars for
SHA-256, 32 chars for MD5) and equal either the all-zero client digest or the
payload digest, matching the README pass criteria. README is unchanged.
… README

- Send and verify File permissions using the gnoi/file/file.proto octal-digit
  encoding (644/640, no base conversion); accept the requested value or the
  value with the reported umask applied, and do not require a non-zero umask.
- Correct the Payload A/B digest byte breakdowns and add the Payload C
  expected SHA-256 digest (with an internal sanity check in the test).
- gNOI-5.4.5 Step 2: replace the non-existent-parent-directory case (which
  file.proto allows to succeed) with empty, relative, and existing-directory
  remote_file values; verify the scratch directory remains intact.
- Use the platform-resolved scratch directory for the negative directory
  File.Remove check instead of a hardcoded path.
- Keep the README language/framework-neutral and clarify the gNOI-5.4.3
  fixed-length unsigned hex digest criteria.
…xists

On platforms with cli_takes_precedence_over_oc (e.g. loopback naming limited
to index 0 and a single loopback unit per routing instance), the test reuses an
existing non-zero loopback subinterface. When none exists, creating a new
loopback unit is rejected by the DUT, so the test loopback configuration (and
its convergence checks and cleanup) is now skipped; the gNOI File checks do not
depend on it. The README is updated accordingly.
Functional translators (system_mount_point_state_ft) only accept single-leaf
queries, so the batched size/available/utilized Get was rejected. Query each
leaf with a wildcard mount-point key instead (three queries in total) and join
the results by mount-point name.
…t negative wording

- validateMountPoint now logs and skips mount points that do not populate
  size, available, or utilized (virtual, read-only, or ephemeral mounts),
  while verifyMountPointsTelemetry still requires at least one mount point
  with non-zero size and available capacity.
- README: File.Stat checks for removed or missing files now say "returns a
  non-OK gRPC error (for example NOT_FOUND)", matching the test code and the
  existing 5.4.5 wording.
@rakvishwakarma
rakvishwakarma force-pushed the b_579093486_gnoi_5_4_readme branch from 128af13 to 3f198e8 Compare November 19, 2026 06:53
…, and address review feedback

- Bound every gnoi.file.File RPC with a 2-minute client deadline so a DUT that
  never terminates a stream fails the step instead of hanging the test; a
  client-side DEADLINE_EXCEEDED is never accepted as a valid rejection.
- Probe platform storage paths (/misc/disk1, harddisk:) before /tmp when
  resolving the scratch directory, since some platforms allow File.Stat on /tmp
  but reject it as a File.Put destination.
- Add the Payload C MD5 digest for DUTs that return an MD5 trailing
  GetResponse{hash}, and assert the 4 x 64 KB Payload C size.
- Tighten the File.Stat path check, handle device-prefixed directory entries,
  add the missing File.Get timeout check in gNOI-5.4.5, and fix a log message.
- Treat UNAVAILABLE, UNIMPLEMENTED, PERMISSION_DENIED, and UNAUTHENTICATED from
  File.Stat as server/session failures rather than file-absent results.
@rakvishwakarma

Copy link
Copy Markdown
Author

/gemini review

@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 Put and Stat protocols (gNOI-5.4), including a detailed test plan, test implementation, metadata, and registry updates. The reviewer identified a violation of the Mandatory State Reversion style guide where top-level properties of a reused loopback interface are modified but not reverted during cleanup on platforms where CLI takes precedence over OC. A code suggestion was provided to restrict these modifications to newly created dedicated loopback interfaces.

When cli_takes_precedence_over_oc is set and an existing lo0 subinterface is
reused, only add the test IPv4/IPv6 addresses and leave the loopback's
interface-level type, description, and enabled leaves unchanged, so cleanup
fully restores the pre-test configuration.
- Add a baseName helper that handles both "/dir/name" and "<device>:name"
  paths, and use it in both verifyFileStat and verifyDirectoryStat.
- Report a client-side timeout on the gNOI-5.4.2 File.Get stream open as a
  failure, consistent with gNOI-5.4.5.

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.

3 participants