Skip to content

Commit

Permalink
moving gribi client config to main function (#3588)
Browse files Browse the repository at this point in the history
Co-authored-by: Swetha-haridasula <[email protected]>
  • Loading branch information
cprabha and Swetha-haridasula authored Jan 7, 2025
1 parent dd73085 commit 3fa63f1
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions feature/gribi/otg_tests/gribi_route_test/gribi_route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,26 @@ func TestGRIBIFailover(t *testing.T) {
t.Log("Configure VRF_Policy")
configureVrfSelectionPolicyC(t, dut)
t.Log("Configure GRIBI")
configureGribiRoute(t, dut)

ctx := context.Background()
gribic := dut.RawAPIs().GRIBI(t)
client := fluent.NewClient()
client.Connection().WithStub(gribic).WithPersistence().WithInitialElectionID(12, 0).
WithRedundancyMode(fluent.ElectedPrimaryClient).WithFIBACK()
client.Start(ctx, t)
defer client.Stop(t)
gribi.FlushAll(client)
defer gribi.FlushAll(client)
client.StartSending(ctx, t)
gribi.BecomeLeader(t, client)

tcArgs := &testArgs{
ctx: ctx,
client: client,
dut: dut,
}

configureGribiRoute(t, dut, tcArgs)

llAddress, found := gnmi.Watch(t, ate.OTG(), gnmi.OTG().Interface("port1.Eth").Ipv4Neighbor(dutPort1.IPv4).LinkLayerAddress().State(), time.Minute, func(val *ygnmi.Value[string]) bool {
return val.IsPresent()
Expand Down Expand Up @@ -394,25 +413,8 @@ func configureVrfSelectionPolicyC(t *testing.T, dut *ondatra.DUTDevice) {
gnmi.Replace(t, dut, dutPolFwdPath.Config(), niP)
}

func configureGribiRoute(t *testing.T, dut *ondatra.DUTDevice) {
func configureGribiRoute(t *testing.T, dut *ondatra.DUTDevice, tcArgs *testArgs) {
t.Helper()
ctx := context.Background()
gribic := dut.RawAPIs().GRIBI(t)
client := fluent.NewClient()
client.Connection().WithStub(gribic).WithPersistence().WithInitialElectionID(12, 0).
WithRedundancyMode(fluent.ElectedPrimaryClient).WithFIBACK()
client.Start(ctx, t)
defer client.Stop(t)
gribi.FlushAll(client)
defer gribi.FlushAll(client)
client.StartSending(ctx, t)
gribi.BecomeLeader(t, client)

tcArgs := &testArgs{
ctx: ctx,
client: client,
dut: dut,
}
tcArgs.client.Modify().AddEntry(t,
fluent.NextHopEntry().WithNetworkInstance(deviations.DefaultNetworkInstance(tcArgs.dut)).
WithIndex(uint64(1)).WithDecapsulateHeader(fluent.IPinIP).
Expand Down

0 comments on commit 3fa63f1

Please sign in to comment.