From 689fdad9f8f1d165acff51b6cbc6da1c0735352e Mon Sep 17 00:00:00 2001 From: Rob Shakir Date: Thu, 17 Oct 2024 10:16:58 +0100 Subject: [PATCH] Add compliance test to check for default RIB ACK with no params. * (M) compliance/compliance.go - Ensure that a RIB_ACK is the default when no ACK mode is specified. --- compliance/compliance.go | 51 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/compliance/compliance.go b/compliance/compliance.go index 4636023..8674610 100644 --- a/compliance/compliance.go +++ b/compliance/compliance.go @@ -579,6 +579,11 @@ var ( ShortName: "Error: Empty NextHopGroup for the IPv4Entry", RequiresDisallowedForwardReferences: true, }, + }, { + In: Test{ + Fn: ClientWithNoParametersACKMode, + ShortName: "Default to RIB_ACK when no SessionParameters sent", + }, }} ) @@ -2114,7 +2119,7 @@ func IPv4EntryEmptyNextHopGroup(c *fluent.GRIBIClient, t testing.TB, _ ...TestOp ops := []func(){ func() { c.Modify().AddEntry(t, fluent.NextHopEntry().WithNetworkInstance(defaultNetworkInstanceName).WithIndex(1).WithIPAddress("192.0.2.3")) - // // NB: NHG is specified to not include any NHs + // NB: NHG is specified to not include any NHs c.Modify().AddEntry(t, fluent.NextHopGroupEntry().WithNetworkInstance(defaultNetworkInstanceName).WithID(11)) c.Modify().AddEntry(t, fluent.IPv4Entry().WithPrefix("203.0.113.1/32").WithNetworkInstance(defaultNetworkInstanceName).WithNextHopGroup(11)) }, @@ -2146,3 +2151,47 @@ func IPv4EntryEmptyNextHopGroup(c *fluent.GRIBIClient, t testing.TB, _ ...TestOp AsResult(), chk.IgnoreOperationID()) } + +// ClientWithNoParametersACKMode ensures that a server complies with using RIB_ACK by default +// when no session parameters are sent. +func ClientWithNoParametersACKMode(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt) { + defer flushServer(c, t) + defer electionID.Inc() + + ctx := context.Background() + c.Start(ctx, t) + defer c.Stop(t) + c.StartSending(ctx, t) + + c.Modify().AddEntry(t, fluent.NextHopEntry().WithNetworkInstance(defaultNetworkInstanceName).WithIndex(1).WithIPAddress("192.0.2.1")) + c.Modify().AddEntry(t, fluent.NextHopGroupEntry().WithNetworkInstance(defaultNetworkInstanceName).WithID(42).AddNextHop(1, 1)) + c.Modify().AddEntry(t, fluent.IPv4Entry().WithPrefix("1.1.1.1/32").WithNetworkInstance(defaultNetworkInstanceName).WithNextHopGroup(42)) + + if err := awaitTimeout(ctx, c, t, time.Minute); err != nil { + t.Fatalf("got unexpected error from server - entries, got: %v, want: nil", err) + } + + res := c.Results(t) + + chk.HasResult(t, res, + fluent.OperationResult(). + WithOperationID(1). + WithProgrammingResult(fluent.InstalledInRIB). + AsResult(), + ) + + chk.HasResult(t, res, + fluent.OperationResult(). + WithOperationID(2). + WithProgrammingResult(fluent.InstalledInRIB). + AsResult(), + ) + + chk.HasResult(t, res, + fluent.OperationResult(). + WithOperationID(3). + WithProgrammingResult(fluent.InstalledInRIB). + AsResult(), + ) + +}