Repository navigation
Conversation
Pull Request Functional Test Report for #5525 / 0522e6cVirtual Devices
Hardware Devices
|
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 introduces necessary updates to the gNPSI and sFlow testing infrastructure to improve compatibility with Cisco platforms. It includes adjustments to test configuration parameters, dynamic handling of sampling rates, and the addition of platform-specific deviation flags to ensure tests run correctly across different vendor implementations. 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 introduces support for gNPSI configuration and sFlow gNPSI export, particularly addressing Cisco-specific deviations. It implements gNPSI configuration from OpenConfig (OC) using gNMI, adds a new deviation missing_sflow_gnpsi_export to handle sFlow export configuration via CLI on Cisco devices, and updates the sampling test to dynamically adjust expected sampling rates and channel capacities based on the sflow_ingress_min_sampling_rate deviation. Additionally, a typo was fixed in the topology binding options. The reviewer recommended refactoring duplicated logic for determining the effective sampling rate into a single helper function to improve maintainability.
|
Updated the deviation details |
|
@ijernoiu - I have validated and the test is not passing. I have attached the logs to the bug 510677651 for reference. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for gNPSI sFlow export configurations, adding a new deviation missing_sflow_gnpsi_export for Cisco devices, implementing the ConfigureSflowGnpsiExport helper, and updating the gNPSI configuration plugin to support OpenConfig-based setup. Additionally, the sFlow test is updated to dynamically handle sampling rates and channel capacities, and to wait for samples to stabilize. Feedback from the review highlights style guide violations regarding configuration plugins and state reversion: specifically, ConfigureGNPSI should append configurations to a *gnmi.SetBatch rather than applying them directly, and both the test configuration and the CLI-based sFlow export configuration must register appropriate cleanup operations using t.Cleanup() to ensure mandatory state reversion.
| params := &cfgplugins.GNPSIParams{ | ||
| Port: gnpsiPort, | ||
| Port: uint16(gnpsiPort), | ||
| SSLProfile: profileName, | ||
| ServerName: serverName, | ||
| NIName: deviations.DefaultNetworkInstance(dut), | ||
| } | ||
| cfgplugins.ConfigureGNPSI(t, dut, params) |
There was a problem hiding this comment.
Following the Repository Style Guide (Section 4, Configuration Plugins Guidelines) and general repository rules, configuration plugins should append OpenConfig configurations to a *gnmi.SetBatch rather than applying them directly. Additionally, all configuration changes must have corresponding cleanup operations registered using t.Cleanup() before executing the configuration push to ensure mandatory state reversion.
params := &cfgplugins.GNPSIParams{
Port: uint16(gnpsiPort),
SSLProfile: profileName,
ServerName: serverName,
NIName: deviations.DefaultNetworkInstance(dut),
}
if sb := cfgplugins.ConfigureGNPSI(t, dut, &gnmi.SetBatch{}, params); sb != nil {
t.Cleanup(func() {
gnmi.Delete(t, dut, gnmi.OC().System().GrpcServer(params.ServerName).Config())
})
sb.Set(t, dut)
}References
- Section 4 of the Repository Style Guide requires configuration plugins to append config to a *gnmi.SetBatch object, and the calling test code is responsible for executing batch.Set() to apply the config. (link)
- Section 1 of the Repository Style Guide requires all cleanup operations to be registered using t.Cleanup() to guarantee they are executed even if the test fails or panics early. (link)
- Always register cleanup operations using 't.Cleanup()' before executing configuration pushes (e.g., 'b.Set()') or destructive operations (e.g., 'gnmi.Delete()').
| func ConfigureSflowGnpsiExport(t *testing.T, dut *ondatra.DUTDevice) { | ||
| t.Log("Configuring sFlow gNPSI export from CLI") | ||
| switch dut.Vendor() { | ||
| case ondatra.CISCO: | ||
| addrUnderscored := strings.ReplaceAll(defaultCollectorAddressV4, ".", "_") | ||
| exporterName := fmt.Sprintf("OC-FEM-%s-%d", addrUnderscored, defaultCollectorPort) | ||
| cli := fmt.Sprintf("flow exporter-map %s\n export protocol gnpsi\n!", exporterName) | ||
| helpers.GnmiCLIConfig(t, dut, cli) | ||
| default: | ||
| t.Logf("ConfigureSflowGnpsiExport: no CLI needed for vendor %s", dut.Vendor()) | ||
| } | ||
| } |
There was a problem hiding this comment.
To adhere to the Repository Style Guide's mandatory state reversion requirement, all configuration changes made during the test must be reverted. For CLI-based configurations, register a corresponding cleanup operation using t.Cleanup() before applying the configuration.
| func ConfigureSflowGnpsiExport(t *testing.T, dut *ondatra.DUTDevice) { | |
| t.Log("Configuring sFlow gNPSI export from CLI") | |
| switch dut.Vendor() { | |
| case ondatra.CISCO: | |
| addrUnderscored := strings.ReplaceAll(defaultCollectorAddressV4, ".", "_") | |
| exporterName := fmt.Sprintf("OC-FEM-%s-%d", addrUnderscored, defaultCollectorPort) | |
| cli := fmt.Sprintf("flow exporter-map %s\n export protocol gnpsi\n!", exporterName) | |
| helpers.GnmiCLIConfig(t, dut, cli) | |
| default: | |
| t.Logf("ConfigureSflowGnpsiExport: no CLI needed for vendor %s", dut.Vendor()) | |
| } | |
| } | |
| func ConfigureSflowGnpsiExport(t *testing.T, dut *ondatra.DUTDevice) { | |
| t.Log("Configuring sFlow gNPSI export from CLI") | |
| switch dut.Vendor() { | |
| case ondatra.CISCO: | |
| addrUnderscored := strings.ReplaceAll(defaultCollectorAddressV4, ".", "_") | |
| exporterName := fmt.Sprintf("OC-FEM-%s-%d", addrUnderscored, defaultCollectorPort) | |
| cli := fmt.Sprintf("flow exporter-map %s\n export protocol gnpsi\n!", exporterName) | |
| t.Cleanup(func() { | |
| negateCli := fmt.Sprintf("flow exporter-map %s\n no export protocol gnpsi\n!", exporterName) | |
| helpers.GnmiCLIConfig(t, dut, negateCli) | |
| }) | |
| helpers.GnmiCLIConfig(t, dut, cli) | |
| default: | |
| t.Logf("ConfigureSflowGnpsiExport: no CLI needed for vendor %s", dut.Vendor()) | |
| } | |
| } |
References
- Section 1 of the Repository Style Guide requires all cleanup operations to be registered using t.Cleanup() to guarantee they are executed even if the test fails or panics early. (link)
- Always register cleanup operations using 't.Cleanup()' before executing configuration pushes (e.g., 'b.Set()') or destructive operations (e.g., 'gnmi.Delete()').
| func ConfigureGNPSI(t *testing.T, dut *ondatra.DUTDevice, params *GNPSIParams) { | ||
| t.Logf("Using gNPSI port: %d", params.Port) | ||
| if deviations.GnpsiOcUnsupported(dut) { | ||
| configureGNPSIFromCLI(t, dut, params) | ||
| } else { | ||
| configureGNPSIFromOC(t, dut) | ||
| configureGNPSIFromOC(t, dut, params) | ||
| } | ||
| } | ||
|
|
||
| func configureGNPSIFromOC(t *testing.T, dut *ondatra.DUTDevice) { | ||
| // TODO : Implement GNPSI OC configuration when supported in OC (ref: https://github.com/openconfig/public/pull/1385) | ||
| t.Fatalf("gNPSI OC configuration is not supported: %s - %s", dut.Version(), dut.Model()) | ||
| func configureGNPSIFromOC(t *testing.T, dut *ondatra.DUTDevice, params *GNPSIParams) { | ||
| t.Log("Configuring gNPSI from OC") | ||
| gnmiServerPath := gnmi.OC().System().GrpcServer(params.ServerName) | ||
| gnmiServer := &oc.System_GrpcServer{ | ||
| Name: ygot.String(params.ServerName), | ||
| Port: ygot.Uint16(params.Port), | ||
| Enable: ygot.Bool(true), | ||
| NetworkInstance: ygot.String(params.NIName), | ||
| } | ||
| gnmiServer.Services = []oc.E_SystemGrpc_GRPC_SERVICE{oc.SystemGrpc_GRPC_SERVICE_GNPSI} | ||
| gnmi.Replace(t, dut, gnmiServerPath.Config(), gnmiServer) | ||
| } |
There was a problem hiding this comment.
In accordance with the Repository Style Guide (Section 4, Configuration Plugins Guidelines) and general repository rules, configuration plugins should append OpenConfig configurations to a *gnmi.SetBatch rather than applying them directly. This allows the calling test code to batch operations and manage cleanups effectively.
func ConfigureGNPSI(t *testing.T, dut *ondatra.DUTDevice, sb *gnmi.SetBatch, params *GNPSIParams) *gnmi.SetBatch {
t.Logf("Using gNPSI port: %d", params.Port)
if deviations.GnpsiOcUnsupported(dut) {
configureGNPSIFromCLI(t, dut, params)
return nil
}
return configureGNPSIFromOC(t, dut, sb, params)
}
func configureGNPSIFromOC(t *testing.T, dut *ondatra.DUTDevice, sb *gnmi.SetBatch, params *GNPSIParams) *gnmi.SetBatch {
t.Log("Configuring gNPSI from OC")
gnmiServerPath := gnmi.OC().System().GrpcServer(params.ServerName)
gnmiServer := &oc.System_GrpcServer{
Name: ygot.String(params.ServerName),
Port: ygot.Uint16(params.Port),
Enable: ygot.Bool(true),
NetworkInstance: ygot.String(params.NIName),
}
gnmiServer.Services = []oc.E_SystemGrpc_GRPC_SERVICE{oc.SystemGrpc_GRPC_SERVICE_GNPSI}
gnmi.BatchReplace(sb, gnmiServerPath.Config(), gnmiServer)
return sb
}References
- Section 4 of the Repository Style Guide requires configuration plugins to append config to a *gnmi.SetBatch object, and the calling test code is responsible for executing batch.Set() to apply the config. (link)
- In configuration plugins (cfgplugins), OpenConfig configurations should be appended to a *gnmi.SetBatch. For CLI fallbacks (when OpenConfig is unsupported), the plugin should push the CLI directly (batched to minimize RPCs) and return nil if no OpenConfig configuration is added, preventing the caller from sending an empty SetRequest.
jayakumarramisetty
left a comment
There was a problem hiding this comment.
please address all gemini comments
No description provided.