Skip to content

[Do Not Merge] Verify Gemini review on #5375: Adding RT-1.36: AIGP feature support test - #6316

Draft
AmrNJ wants to merge 1 commit into
openconfig:AmrNJ/verify-gemini-5375-basefrom
AmrNJ:verify-gemini-5375
Draft

AmrNJ wants to merge 1 commit into
openconfig:AmrNJ/verify-gemini-5375-basefrom
AmrNJ:verify-gemini-5375

Conversation

@AmrNJ

@AmrNJ AmrNJ commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Temporary draft PR duplicating the exact changes from #5375 to verify what is flagged by Gemini Code Assist under the current .gemini/styleguide.md.

Original PR: #5375
Readme: https://github.com/openconfig/featureprofiles/blob/main/feature/bgp/otg_tests/aigp_test/README.md

@OpenConfigBot

OpenConfigBot commented Nov 23, 2026 •

Copy link
Copy Markdown

Pull Request Functional Test Report for #6316 / e25ee08

Virtual Devices

Device Test Status Test Documentation Job Raw Log
Arista cEOS status
RT-1.36: failure
RT-1.36: AIGP feature support test
afc9ab8d Log
Cisco 8000E status
RT-1.36: failure
RT-1.36: AIGP feature support test
eaf59872 Log
Cisco XRd status
RT-1.36: failure
RT-1.36: AIGP feature support test
aeb9e5ff Log
Juniper ncPTX status
RT-1.36: failure
RT-1.36: AIGP feature support test
b96939c2 Log
Nokia SR Linux status
RT-1.36: failure
RT-1.36: AIGP feature support test
9d82f66c Log
Openconfig Lemming status
RT-1.36: failure
RT-1.36: AIGP feature support test
c75f2629 Log

Hardware Devices

Device Test Status Test Documentation Raw Log
Arista status
RT-1.36: pending authorization
RT-1.36: AIGP feature support test
Cisco status
RT-1.36: pending authorization
RT-1.36: AIGP feature support test
Juniper status
RT-1.36: pending authorization
RT-1.36: AIGP feature support test
Nokia status
RT-1.36: pending authorization
RT-1.36: AIGP feature support test

Help

@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 test suite for the AIGP (Accumulated IGP Metric) feature in BGP. It includes the implementation of the test logic, necessary infrastructure updates to handle AIGP-specific routing policies and interface configurations, and the addition of required platform deviations to ensure compatibility across different vendors.

Highlights

  • New Test Implementation: Added a new test file aigp_test.go to support the AIGP (Accumulated IGP Metric) feature, covering attribute validation, tie-breaking, propagation, and increment logic.
  • Infrastructure Updates: Updated internal helper libraries (attrs.go, bgp.go, bgp_policy.go, interface.go, networkinstance.go) to support AIGP-specific configurations, including route-map policy application and subinterface-to-network-instance mapping.
  • Metadata and Deviations: Updated metadata.textproto and metadata.proto to include new platform deviations required for AIGP testing, such as aigp_route_metric_not_supported and bgp_adj_rib_oc_unsupported.
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. ↩

@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 comprehensive test suite for BGP AIGP feature support, along with corresponding helper functions, configuration plugins, and platform deviations. The review feedback highlights several critical issues that need to be addressed: a protocol stoppage in testAIGPPropagationNexthop that is never restarted, a lack of mandatory state reversion cleanup using t.Cleanup(), and a potential runtime panic in verifyBestPath due to unsafe slice access. Additionally, traffic validation is triggered prematurely, the OpenConfig path in ApplyRoutePolicyToBGPPeer is broken, non-compliant IP addresses are used, and multiple instances of gnmi.Get should be replaced with gnmi.Watch to prevent test flakiness.

gnmi.BatchUpdate(b, gnmi.OC().NetworkInstance(niOriginate).TableConnection(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_DIRECTLY_CONNECTED, oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, oc.Types_ADDRESS_FAMILY_IPV4).Config(), tableConn1)
b.Set(t, dut2)

otg.StopProtocols(t)

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.

critical

In testAIGPPropagationNexthop, otg.StopProtocols(t) is called, but protocols are never restarted. This will cause subsequent test cases to fail because the OTG BGP sessions will be down, and VerifyDUTBGPEstablished will fail. It should be otg.StartProtocols(t) or at least not stopped.

Suggested change
otg.StopProtocols(t)
otg.StartProtocols(t)
References
  1. In multi-subtest routing or BGP tests where subsequent subtests depend on routes advertised in previous subtests, do not withdraw routes at the end of each subtest. Instead, rely on a global OTG cleanup to stop protocols and withdraw all routes at the end of the test.

Comment on lines +1232 to +1249
func TestAigp(t *testing.T) {
dut1 := ondatra.DUT(t, "dut1")
dutTestData[0].dut = dut1

dut2 := ondatra.DUT(t, "dut2")
dutTestData[1].dut = dut2

ate := ondatra.ATE(t, "ate")

// Configure network instances on DUT1 and DUT2
configureNetworkInstances(t, dutTestData)

// Configure DUT1 and DUT2
configureDut(t, dutTestData)
port1DstMac = gnmi.Get(t, dut1, gnmi.OC().Interface(dutTestData[0].lagName[0]).Ethernet().MacAddress().State())

// Configure on OTG
otgConfig := configureOTG(t, ate)

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 test configures network instances, interfaces, routing policies, BGP, and ISIS on both DUTs, but does not register any cleanup operations using t.Cleanup() to revert these changes. This violates the 'Mandatory State Reversion' and 'Use t.Cleanup()' rules in the repository style guide.

References
  1. Tests must always leave the system in the exact original state it was in prior to the test execution, and all cleanup operations must be registered using t.Cleanup(). (link)
  2. To adhere to the mandatory state reversion policy and prevent device state pollution, ensure that t.Cleanup explicitly deletes all applied configurations rather than just deleting the VRFs.
  3. Always register cleanup operations using 't.Cleanup()' before executing configuration pushes or destructive operations.

Comment on lines +1115 to +1117
update := getResponse.GetNotification()[0].GetUpdate()[0]
val := update.GetVal()
bestPaths := val.Value.(*gpb.TypedValue_UintVal).UintVal

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 code accesses getResponse.GetNotification()[0].GetUpdate()[0] directly without checking if the slices are nil or empty. This can cause a runtime panic if the response is empty. Please add appropriate safety checks.

notifications := getResponse.GetNotification()
if len(notifications) == 0 || len(notifications[0].GetUpdate()) == 0 {
	t.Fatalf("gNMI GetResponse is empty or missing updates")
}
update := notifications[0].GetUpdate()[0]
val := update.GetVal()

Comment on lines +1427 to +1428
otg.StartTraffic(t)
validateTrafficFlows(t, otg, otgConfig, otgConfig.Flows().Items())

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

In testAIGPAttributeValidation, validateTrafficFlows is called immediately after otg.StartTraffic(t) without waiting for the traffic to finish transmitting. Since StartTraffic is non-blocking, this will cause the test to fail because the traffic has not completed. Please add a wait or watch for traffic to complete.

References
  1. Do not implement custom polling loops that repeatedly start and stop traffic to verify 0% packet loss, as this causes traffic churn and flaky packet counting. Instead, start traffic continuously and use standard helpers like otgutils.ExpectedTrafficLoss which internally use gnmi.Watch to wait for the loss to stabilize.

Comment on lines +575 to +577
} else {
t.Errorf("OC is not supported for vendor %s", dut.Vendor())
}

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

In ApplyRoutePolicyToBGPPeer, if AIGPRouteMetricNotSupported is false, the code fails the test with t.Errorf("OC is not supported...") instead of implementing the OpenConfig configuration. This completely breaks the OpenConfig path.

References
  1. In test helper functions or test cases, do not catch configuration push errors to silently fall back to a different configuration. Instead, explicitly fail the test and handle vendor-specific variations using platform deviations.

attr: &attrs.Attributes{
Desc: "DUT2 Loopback 50",
IPv4: "198.60.50.2",
IPv6: "2001:db8:50::2",

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 IP address 198.60.50.2 is outside the allowed RFC 5737 blocks (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24) and 198.18.0.0/15. This violates the 'Network Assignments' style guide rule.

Suggested change
IPv6: "2001:db8:50::2",
IPv4: "198.19.50.2",
References
  1. Use RFC 5737 blocks or 100.64.0.0/10, 198.18.0.0/15 for IPv4 network assignments. (link)

networkInstance: testInstanceParams,
}

ateIPv4Prefixes = []string{"198.51.210.0", "198.51.220.0"}

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 IP addresses 198.51.210.0 and 198.51.220.0 are outside the allowed RFC 5737 blocks and 198.18.0.0/15. This violates the 'Network Assignments' style guide rule.

Suggested change
ateIPv4Prefixes = []string{"198.51.210.0", "198.51.220.0"}
ateIPv4Prefixes = []string{"198.18.100.0", "198.18.110.0"}
References
  1. Use RFC 5737 blocks or 100.64.0.0/10, 198.18.0.0/15 for IPv4 network assignments. (link)

Comment on lines +1164 to +1169
sent := gnmi.Get(t, dut,
gnmi.OC().NetworkInstance(ni).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp().Neighbor(nbrAddr).Messages().Sent().State(),
)
if sent.GetUPDATE() == 0 {
t.Errorf("bgp neighbor %s in NI %s has sent zero UPDATE messages", nbrAddr, ni)
}

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

verifyBGPUpdatesSentNonZero uses gnmi.Get to query the BGP update messages sent counter immediately. This can lead to flaky tests because the counter might still be 0 when queried. It should use gnmi.Watch to wait for the counter to become non-zero, adhering to the 'Querying Counters' rule.

Suggested change
sent := gnmi.Get(t, dut,
gnmi.OC().NetworkInstance(ni).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp().Neighbor(nbrAddr).Messages().Sent().State(),
)
if sent.GetUPDATE() == 0 {
t.Errorf("bgp neighbor %s in NI %s has sent zero UPDATE messages", nbrAddr, ni)
}
_, ok := gnmi.Watch(t, dut,
gnmi.OC().NetworkInstance(ni).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp().Neighbor(nbrAddr).Messages().Sent().State(),
30*time.Second,
func(val *ygnmi.Value[*oc.NetworkInstance_Protocol_Bgp_Neighbor_Messages_Sent]) bool {
sent, present := val.Val()
return present && sent.GetUPDATE() > 0
},
).Await(t)
if !ok {
t.Errorf("bgp neighbor %s in NI %s has sent zero UPDATE messages", nbrAddr, ni)
}
References
  1. Avoid using gnmi.Get for telemetry paths where some vendors only support streaming telemetry. Instead, use gnmi.Watch.

Comment on lines +981 to +984
status := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).OperStatus().State())
if status != oc.Interface_OperStatus_UP {
t.Errorf("interface %s on %s: want UP, got %v", intfName, dut.Name(), status)
}

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

verifyInterfaceOperStatus uses gnmi.Get to check the interface operational status immediately. This can cause flakiness if the interface takes a few seconds to come up. It should use gnmi.Watch to wait for the status to become UP.

Suggested change
status := gnmi.Get(t, dut, gnmi.OC().Interface(intfName).OperStatus().State())
if status != oc.Interface_OperStatus_UP {
t.Errorf("interface %s on %s: want UP, got %v", intfName, dut.Name(), status)
}
_, ok := gnmi.Watch(t, dut, gnmi.OC().Interface(intfName).OperStatus().State(), 30*time.Second, func(val *ygnmi.Value[oc.E_Interface_OperStatus]) bool {
status, present := val.Val()
return present && status == oc.Interface_OperStatus_UP
}).Await(t)
if !ok {
t.Errorf("interface %s on %s: did not become UP", intfName, dut.Name())
}
References
  1. Use 'gnmi.Await' to wait for operational state convergence before querying state with 'gnmi.Get' immediately after pushing configuration, ensuring test stability and reliability.


// Configure DUT1 and DUT2
configureDut(t, dutTestData)
port1DstMac = gnmi.Get(t, dut1, gnmi.OC().Interface(dutTestData[0].lagName[0]).Ethernet().MacAddress().State())

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 code uses gnmi.Get to retrieve the MAC address of the LAG interface immediately after configuration. This can return an empty string if the MAC address is not yet populated in the state, causing traffic flow configuration to fail. It should use gnmi.Watch to wait for a non-empty MAC address.

macVal, ok := gnmi.Watch(t, dut1, gnmi.OC().Interface(dutTestData[0].lagName[0]).Ethernet().MacAddress().State(), 30*time.Second, func(val *ygnmi.Value[string]) bool {
	mac, present := val.Val()
	return present && mac != ""
}).Await(t)
if !ok {
	t.Fatalf("Failed to get MAC address for interface %s", dutTestData[0].lagName[0])
}
port1DstMac, _ = macVal.Val()
References
  1. Use 'gnmi.Await' to wait for operational state convergence before querying state with 'gnmi.Get' immediately after pushing configuration, ensuring test stability and reliability.

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