compliance

package
v0.0.0-...-800520f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package compliance encapsulates a set of compliance tests for gRIBI. It is a test only library. All tests are of the form func(c *fluent.GRIBIClient, t testing.TB) where the client is the one that should be used for the test. The testing.TB object is used to report errors.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TestSuite is the library of tests that can be run for compliance.
	TestSuite = []*TestSpec{{
		In: Test{
			Fn:        ModifyConnection,
			ShortName: "Modify RPC connection",
		},
	}, {
		In: Test{
			Fn:        ModifyConnectionWithElectionID,
			ShortName: "Modify RPC Connection with Election ID",
		},
	}, {
		In: Test{
			Fn:        ModifyConnectionSinglePrimaryPreserve,
			ShortName: "Modify RPC Connection with invalid persist/redundancy parameters",
		},
	}, {
		In: Test{
			Fn:        InvalidElectionIDAndAFTOperation,
			ShortName: "Invalid updated election ID and AFTOperation in same ModifyRequest",
		},
	}, {
		In: Test{
			Fn:        InvalidElectionIDAndParams,
			ShortName: "Invalid update election ID and SessionParams in same ModifyRequest",
		},
	}, {
		In: Test{
			Fn:        InvalidParamsAndAFTOperation,
			ShortName: "Invalid session params and AFT operation in same ModifyRequest",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddIPv4Entry, fluent.InstalledInRIB),
			Reference: "TE-2.1.1.1",
			ShortName: "Add IPv4 entry that can be programmed on the server - with RIB ACK",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(AddIPv4Entry, fluent.InstalledInFIB),
			Reference:      "TE-2.1.1.2",
			ShortName:      "Add IPv4 entry that can be programmed on the server - with FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddUnreferencedNextHopGroup, fluent.InstalledInRIB),
			ShortName: "Add next-hop-group entry that can be resolved on the server, no referencing IPv4 entries - with RIB ACK",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(AddUnreferencedNextHopGroup, fluent.InstalledInFIB),
			ShortName:      "Add next-hop-group entry that can be resolved on the server, no referencing IPv4 entries - with FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:                       AddIPv4EntryRandom,
			ShortName:                "Add IPv4 entries that are resolved by NHG and NH, in random order",
			RequiresServerReordering: true,
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(AddIPv4ToMultipleNHsSingleRequest, fluent.InstalledInFIB),
			ShortName:      "Add IPv4 entries that are resolved to a next-hop-group containing multiple next-hops (single ModifyRequest) - with FIB ACK",
			Reference:      "TE-2.1.2.1",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddIPv4ToMultipleNHsSingleRequest, fluent.InstalledInRIB),
			ShortName: "Add IPv4 entries that are resolved to a next-hop-group containing multiple next-hops (single ModifyRequest) - with RIB ACK",
			Reference: "TE-2.1.2.1",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(AddIPv4ToMultipleNHsMultipleRequests, fluent.InstalledInFIB),
			ShortName:      "Add IPv4 entries that are resolved to a next-hop-group containing multiple next-hops (multiple ModifyRequests) - with FIB ACK",
			Reference:      "TE-2.1.2.2",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddIPv4ToMultipleNHsMultipleRequests, fluent.InstalledInRIB),
			ShortName: "Add IPv4 entries that are resolved to a next-hop-group containing multiple next-hops (multiple ModifyRequests) - with RIB ACK",
			Reference: "TE-2.1.2.2",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(DeleteIPv4Entry, fluent.InstalledInRIB),
			ShortName: "Delete IPv4 entry within default network instance - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(DeleteReferencedNHGFailure, fluent.InstalledInRIB),
			ShortName: "Delete NHG entry that is referenced - failure - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(DeleteReferencedNHFailure, fluent.InstalledInRIB),
			ShortName: "Delete NH entry that is referenced - failure - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(DeleteNextHopGroup, fluent.InstalledInRIB),
			ShortName: "Delete NHG entry successfully - RIB ACK",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(DeleteNextHopGroup, fluent.InstalledInFIB),
			ShortName:      "Delete NHG entry successfully - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(DeleteNextHop, fluent.InstalledInRIB),
			ShortName: "Delete NH entry successfully - RIB ACK",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(DeleteNextHop, fluent.InstalledInRIB),
			ShortName:      "Delete NH entry successfully - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        AddIPv4Metadata,
			ShortName: "Add Metadata for IPv4 entry",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddIPv4EntryDifferentNINHG, fluent.InstalledInRIB),
			ShortName: "Add IPv4 Entry that references a NHG in a different network instance",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(AddDeleteAdd, fluent.InstalledInRIB),
			ShortName: "Add-Delete-Add for IPv4Entry - RIB ACK",
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceNH, fluent.InstalledInRIB),
			ShortName:               "Implicit replace NH entry - RIB ACK",
			RequiresImplicitReplace: true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceNHG, fluent.InstalledInRIB),
			ShortName:               "Implicit replace NHG entry - RIB ACK",
			RequiresImplicitReplace: true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceIPv4Entry, fluent.InstalledInRIB),
			ShortName:               "Implicit replace IPv4 entry - RIB ACK",
			RequiresImplicitReplace: true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceNH, fluent.InstalledInFIB),
			ShortName:               "Implicit replace NH entry - FIB ACK",
			RequiresImplicitReplace: true,
			RequiresFIBACK:          true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceNHG, fluent.InstalledInFIB),
			ShortName:               "Implicit replace NHG entry - FIB ACK",
			RequiresImplicitReplace: true,
			RequiresFIBACK:          true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(ImplicitReplaceIPv4Entry, fluent.InstalledInFIB),
			ShortName:               "Implicit replace IPv4 entry - FIB ACK",
			RequiresImplicitReplace: true,
			RequiresFIBACK:          true,
		},
	}, {
		In: Test{
			Fn:                       makeTestWithACK(IdempotentDelete, fluent.InstalledInRIB),
			ShortName:                "Idempotent Delete entry - RIB ACK",
			RequiresIdempotentDelete: true,
		},
	}, {
		In: Test{
			Fn:                       makeTestWithACK(IdempotentDelete, fluent.InstalledInFIB),
			ShortName:                "Idempotent Delete entry - FIB ACK",
			RequiresIdempotentDelete: true,
			RequiresFIBACK:           true,
		},
	}, {
		In: Test{
			Fn:        ReplaceMissingNH,
			ShortName: "Ensure failure for a NH entry that does not exist",
		},
	}, {
		In: Test{
			Fn:        ReplaceMissingNHG,
			ShortName: "Ensure failure for a NHG entry that does not exist",
		},
	}, {
		In: Test{
			Fn:        ReplaceMissingIPv4Entry,
			ShortName: "Ensure failure for an IPv4 entry that does not exist",
		},
	}, {
		In: Test{
			Fn:        TestOperationIsolation,
			ShortName: "AFTOperation responses must not be sent to other clients",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(GetNH, fluent.InstalledInRIB),
			ShortName: "Get for installed NH - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(GetNHG, fluent.InstalledInRIB),
			ShortName: "Get for installed NHG - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(GetIPv4, fluent.InstalledInRIB),
			ShortName: "Get for installed IPv4 Entry - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(GetIPv4Chain, fluent.InstalledInRIB),
			ShortName: "Get for installed chain of entries - RIB ACK",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(GetBenchmarkNH, fluent.InstalledInRIB),
			ShortName: "Benchmark Get for next-hops",
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(GetNH, fluent.InstalledInFIB),
			ShortName:      "Get for installed NH - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(GetNHG, fluent.InstalledInFIB),
			ShortName:      "Get for installed NHG - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(GetIPv4, fluent.InstalledInFIB),
			ShortName:      "Get for installed IPv4 Entry - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(GetIPv4Chain, fluent.InstalledInFIB),
			ShortName:      "Get for installed chain of entries - FIB ACK",
			RequiresFIBACK: true,
		},
	}, {
		In: Test{
			Fn:        TestUnsupportedElectionParams,
			ShortName: "Election - Ensure that election ID is not accepted in ALL_PRIMARY mode",
		},
	}, {
		In: Test{
			Fn:        TestDifferingElectionParameters,
			ShortName: "Election - Ensure that a client with mismatched parameters is rejected",
		},
	}, {
		In: Test{
			Fn:        TestMatchingElectionParameters,
			ShortName: "Election - Matching parameters for two clients in election",
		},
	}, {
		In: Test{
			Fn:        TestParamsDifferFromOtherClients,
			ShortName: "Election - Ensure client with differing parameters is rejected",
		},
	}, {
		In: Test{
			Fn:        TestLowerElectionID,
			ShortName: "Election - Lower election ID from new client",
		},
	}, {
		In: Test{
			Fn:        TestActiveAfterMasterChange,
			ShortName: "Election - Active entries after new master connects",
		},
	}, {
		In: Test{
			Fn:        TestNewElectionIDNoUpdateRejected,
			ShortName: "Election - Unannounced master operations are rejected",
		},
	}, {
		In: Test{
			Fn:        TestIncElectionID,
			ShortName: "Election - Incrementing election ID is honoured, and older IDs are rejected",
		},
	}, {
		In: Test{
			Fn:        TestDecElectionID,
			ShortName: "Election - Decrementing election ID is ignored",
		},
	}, {
		In: Test{
			Fn:        TestSameElectionIDFromTwoClients,
			ShortName: "Election - Sending same election ID from two clients",
		},
	}, {
		In: Test{
			Fn:        TestElectionIDAsZero,
			ShortName: "Election - Sending election ID as zero",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(FlushFromMasterDefaultNI, fluent.InstalledInRIB),
			ShortName: "Flush of all entries in default NI by elected master",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(FlushFromNonMasterDefaultNI, fluent.InstalledInRIB),
			ShortName: "Flush from non-elected master returns error",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(FlushNIUnspecified, fluent.InstalledInRIB),
			ShortName: "Flush without specifying network instance returns error",
		},
	}, {
		In: Test{
			Fn:        makeTestWithACK(FlushFromOverrideDefaultNI, fluent.InstalledInRIB),
			ShortName: "Flush from client overriding election is honoured",
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(FlushOfSpecificNI, fluent.InstalledInRIB),
			ShortName:               "Flush to specific network instance is honoured",
			RequiresNonDefaultNINHG: true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(FlushOfAllNIs, fluent.InstalledInRIB),
			ShortName:               "Flush all network instances",
			RequiresNonDefaultNINHG: true,
		},
	}, {
		In: Test{
			Fn:                      makeTestWithACK(FlushPreservesDefaultNI, fluent.InstalledInRIB),
			ShortName:               "Flush non-default network instances preserves the default",
			RequiresNonDefaultNINHG: false,
		},
	}, {
		In: Test{
			Fn:           makeTestWithACK(AddMPLSEntry, fluent.InstalledInRIB),
			ShortName:    "MPLS simple programming entry",
			RequiresMPLS: true,
		},
	}, {
		In: Test{
			Fn:           makeTestWithACK(DeleteMPLSEntry, fluent.InstalledInRIB),
			ShortName:    "MPLS delete entry",
			RequiresMPLS: true,
		},
	}, {
		In: Test{
			Fn:           makeTestWithACK(AddMPLSEntryWithLabelStack, fluent.InstalledInRIB),
			ShortName:    "MPLS add entry with NH label stack",
			RequiresMPLS: true,
		},
	}, {
		In: Test{
			Fn:           makeTestWithACK(AddIPv6Entry, fluent.InstalledInRIB),
			ShortName:    "Add IPv6 entry that can be programmed on the server - with RIB ACK",
			RequiresIPv6: true,
		},
	}, {
		In: Test{
			Fn:             makeTestWithACK(AddIPv6Entry, fluent.InstalledInFIB),
			ShortName:      "Add IPv6 entry that can be programmed on the server - with FIB ACK",
			RequiresFIBACK: true,
			RequiresIPv6:   true,
		},
	}, {
		In: Test{
			Fn:           AddIPv6Metadata,
			ShortName:    "Add IPv6 entry with metadata",
			RequiresIPv6: true,
		},
	}}
)

Functions

func AddDeleteAdd

func AddDeleteAdd(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddDeleteAdd tests that when a single ModifyRequest contains a sequence of operations, each is acknowledged separately by the server. Note that this does not imply that the transactions cannot be coaesced when writing to hardware, but in order to prevent pending transactions at the client, all must be acknowledged.

func AddIPv4Entry

func AddIPv4Entry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddIPv4Entry adds a fully referenced IPv4Entry and checks whether the specified ACK type (wantACK) is returned.

func AddIPv4EntryDifferentNINHG

func AddIPv4EntryDifferentNINHG(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddIPv4EntryDifferentNINHG adds an IPv4 entry that references a next-hop-group within a different network instance, and validates that the entry is successfully installed.

func AddIPv4EntryRandom

func AddIPv4EntryRandom(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

addIPv4Random adds an IPv4 Entry, shuffling the order of the entries, and validating those entries are ACKed.

func AddIPv4Metadata

func AddIPv4Metadata(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

AddIPv4Metadata adds an IPv4 Entry (and its dependencies) with metadata alongside the entry.

func AddIPv4ToMultipleNHsMultipleRequests

func AddIPv4ToMultipleNHsMultipleRequests(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddIPv4ToMultipleNHsMultipleRequests creates an IPv4 entry which references a NHG containing 2 NHs within multiple ModifyReqests, validating that they are installed in the specified RIB or FIB according to wantACK.

func AddIPv4ToMultipleNHsSingleRequest

func AddIPv4ToMultipleNHsSingleRequest(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddIPv4ToMultipleNHsSingleRequest is the internal implementation of the single request installation of an IPv4Entry referencing a NHG that contains multiple NHs. It uses the wantACK parameter to determine the type of acknowledgement that is expected from the server.

func AddIPv6Entry

func AddIPv6Entry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddIPv6Entry adds a fully referenced IPv4Entry and checks whether the specified ACK type (wantACK) is returned.

func AddIPv6Metadata

func AddIPv6Metadata(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

AddIPv6Metadata adds an IPv6 Entry (and its dependencies) with metadata alongside the entry.

func AddMPLSEntry

func AddMPLSEntry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddMPLSEntry validates that the gRIBI server supports adding MPLS entries to the set of AFT entries supported. It expects the wantACK acknowledgement type.

func AddMPLSEntryWithLabelStack

func AddMPLSEntryWithLabelStack(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddMPLSEntryWithLabelStack validates that the gRIBI server supports adding MPLS entries where a label stack is specified in the next-hop. It expects the wantACK acknowledgement type.

func AddUnreferencedNextHopGroup

func AddUnreferencedNextHopGroup(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

AddUnreferencedNextHopGroup adds a NHG that is not referenced by any other entry. An ACK is expected, and is validated to be of the type specified by wantACK.

func DeleteIPv4Entry

func DeleteIPv4Entry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteIPv4Entry deletes an IPv4 entry from the server's RIB.

func DeleteMPLSEntry

func DeleteMPLSEntry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteMPLSEntry validates that a gRIBI server supports deleting MPLS entries that are installed in the set of LabelEntries on the server. It expects the wantACK acknowledgement type.

func DeleteNextHop

func DeleteNextHop(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteNextHop attempts to delete the NH entries within the base topology and expects success. The ACK type returned is validated against wantACK.

func DeleteNextHopGroup

func DeleteNextHopGroup(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteNextHopGroup attempts to delete a NHG entry that is not referenced and expects success. The ACK type expected is validated against wantACK.

func DeleteReferencedNHFailure

func DeleteReferencedNHFailure(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteReferencedNHFailure attempts to delete a NH entry that is referened from the RIB and expects a failure.

func DeleteReferencedNHGFailure

func DeleteReferencedNHGFailure(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

DeleteReferencedNHGFailure attempts to delete a NextHopGroup entry that is referenced from the RIB, and expects a failure.

func DoModifyOps

func DoModifyOps(c *fluent.GRIBIClient, t testing.TB, ops []func(), wantACK fluent.ProgrammingResult, randomise bool) []*client.OpResult

DoModifyOps performs the series of operations in ops using the context client c. wantACK specifies the ACK type to request from the server, and randomise specifies whether the operations should be sent in order, or randomised.

If the caller sets randomise to true, the client MUST NOT, rely on the operation ID to validate the entries, since this is allocated internally to the client.

func FlushFromMasterDefaultNI

func FlushFromMasterDefaultNI(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushFromMasterDefaultNI programs a chain of entries into the default NI with the specified wantACK mode and then issues a Flush towards the server using the current master's election ID. It validates that no entries remain in the default network instance using the Get RPC.

func FlushFromNonMasterDefaultNI

func FlushFromNonMasterDefaultNI(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushFromNonMasterDefaultNI sends a Flush to the server using an old election ID and validates that the programmed chain of entries are not removed form the default NI using the Get RPC.

func FlushFromOverrideDefaultNI

func FlushFromOverrideDefaultNI(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushFromOverrideDefaultNI programs a chain of entries into the default NI with the specified wantACK mode, and then issues a Flush towards the server specifying that the election ID should be overridden and ensures that entries are removed using the Get RPC.

func FlushNIUnspecified

func FlushNIUnspecified(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushNIUnspecified sends a Flush to the server without specifying the network instsance, and then validates that the programmed chain of entries are not removed.

func FlushOfAllNIs

func FlushOfAllNIs(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushOfAllNIs programs entries in two network instances - the default and a named VRF and ensures that entries are removed from both when the Flush specifies that all network instances are to be removed.

func FlushOfSpecificNI

func FlushOfSpecificNI(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushOfSpecificNI programs entries into two network-instances, the default and a named L3VRF. It subsequently issues a Flush RPC and ensures that entries that are within the flushed network instance (the default) are removed, but the others are preserved.

func FlushPreservesDefaultNI

func FlushPreservesDefaultNI(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

FlushPreservesDefaultNI programs entries in the default network-instance and flushes the non-default VRF, then ensures that entries in the default is still preserved. This is a weaker version of FlushOfSpecificNI.

func GetBenchmarkNH

func GetBenchmarkNH(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

GetBenchmarkNH benchmarks the performance of Get populating the server with N next-hop instances and measuring latency of the Get returned by the server. No validation of the returned contents is performed.

func GetIPv4

func GetIPv4(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

GetIPv4 validates that an installed IPv4 entry is returned via the Get RPC.

func GetIPv4Chain

func GetIPv4Chain(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

GetIPv4Chain validates that Get for all AFTs returns the chain of IPv4Entry->NHG->NH required.

func GetNH

func GetNH(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

GetNH validates that an installed next-hop is returned via the Get RPC.

func GetNHG

func GetNHG(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

GetNHG validates that an installed next-hop-group is returned via the Get RPC.

func IdempotentDelete

func IdempotentDelete(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

IdempotentDelete performs two delete operations for the same NextHop, NextHopGroup, and IPv4Entry, validating that the server handles duplicate operations successfully.

func ImplicitReplaceIPv4Entry

func ImplicitReplaceIPv4Entry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

ImplicitReplaceIPv4Entry performs two add operations for the same NextHopGroup entry, validating that the server handles this as an implicit replace of the entry.

func ImplicitReplaceNH

func ImplicitReplaceNH(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

ImplicitReplaceNH performs two add operations for the same NextHop entry, validating that the server handles this as an implicit replace of the entry.

func ImplicitReplaceNHG

func ImplicitReplaceNHG(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt)

ImplicitReplaceNHG performs two add operations for the same NextHopGroup entry, validating that the server handles this as an implicit replace of the entry.

func InvalidElectionIDAndAFTOperation

func InvalidElectionIDAndAFTOperation(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

InvalidElectionIDAndAFTOperation ensures that the server returns an error when the client attempts to update the election ID whilst simultaenously specifying an operation.

func InvalidElectionIDAndParams

func InvalidElectionIDAndParams(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

InvalidElectionIDAndParams validates that the server returns an error when a client specifies an update election ID at the same time as specifying session parameters (which are illegal after the first message).

func InvalidParamsAndAFTOperation

func InvalidParamsAndAFTOperation(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

InvalidElectionIDAndAFTOperation validates that the server returns an error when a client specifies session parameters (which must be the first message in the stream) and an AFTOperation simulateously.

func ModifyConnection

func ModifyConnection(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ModifyConnection is a test that opens a Modify RPC. It determines that there is no response from the server.

func ModifyConnectionSinglePrimaryPreserve

func ModifyConnectionSinglePrimaryPreserve(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ModifyConnectionSinglePrimaryPreserve tests that the server returns an error when a client sends ALL_PRIMARY mode with persistence enabled. This is expected to be an erroneous combination and hence it checks that the server returns an error that specifies unsupported parameters and the failed precondition code.

func ModifyConnectionWithElectionID

func ModifyConnectionWithElectionID(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ModifyConnectionWithElectionID is a test that opens a Modify RPC, with initial SessionParameters. It determines that there is a successful response from the server for the election ID.

func ReplaceMissingIPv4Entry

func ReplaceMissingIPv4Entry(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ReplaceMissingIPv4Entry validates that an operation for an IPv4 entry that does not exist on the server fails.

func ReplaceMissingNH

func ReplaceMissingNH(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ReplaceMissingNH validates that an operation for a next-hop entry that does not exist on the server fails.

func ReplaceMissingNHG

func ReplaceMissingNHG(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

ReplaceMissingNHG validates that an operation for a next-hop-group entry that does not exist on the server fails.

func SecondClient

func SecondClient(c *fluent.GRIBIClient) *secondClient

SecondClient returns an addtional gRIBI client.

func SetDefaultNetworkInstanceName

func SetDefaultNetworkInstanceName(n string)

SetDefaultNetworkInstanceName allows an external caller to specify a network instance name to be used for the default network instance.

func SetElectionID

func SetElectionID(v uint64)

SetElectionID allows an external caller to specify an election ID to be used for subsequent calls.

func SetNonDefaultVRFName

func SetNonDefaultVRFName(n string)

SetNonDefaultVRFName allows an external caller to specify a network-instance name to be used as a non-default Layer 3 VRF.

func TestActiveAfterMasterChange

func TestActiveAfterMasterChange(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestActiveAfterMasterChange tests whether entries installed by client A remain active when clientB connects and provides a higher election ID. The presence of an entry is verified through the Get RPC.

func TestDecElectionID

func TestDecElectionID(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

TestDecElectionID validates that when a client decreases the election ID it is not honoured by the server, and the server reports back the highest ID it has seen.

func TestDifferingElectionParameters

func TestDifferingElectionParameters(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestDifferingElectionParameters checks that when a client A is connected with parameters that differ to those that are used by a new client B an error is returned to client B.

opts must contain a SecondClient option such that there is a second stub to be used to the device.

func TestElectionIDAsZero

func TestElectionIDAsZero(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

TestElectionIDAsZero is the test to send (0, 0) as the election ID The server should respond with RPC error Invalid Argument

func TestIncElectionID

func TestIncElectionID(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

TestIncElectionID ensures that when the election ID is updated explicitly by the client to a higher value that the new value is accepted, and the lower values are rejected.

func TestLowerElectionID

func TestLowerElectionID(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestLowerElectionID tests whether a client connecting with a lower election ID is accepted, and the election ID reported to it is the higher election ID.

func TestMatchingElectionParameters

func TestMatchingElectionParameters(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestMatchingElectionParameters tests whether two clients can connect with the same parameters and the connection is succesful.

func TestNewElectionIDNoUpdateRejected

func TestNewElectionIDNoUpdateRejected(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

TestNewElectionIDNoUpdateRejected checks that a client that specifies a higher election ID without explicitly updating the ID is rejected.

func TestOperationIsolation

func TestOperationIsolation(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestOperationIsolation verifies no AFTOperation responses are received on a second client after the primary client has disconnected.

func TestParamsDifferFromOtherClients

func TestParamsDifferFromOtherClients(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestParamsDifferFromOtherClients checks that when a client A is connected as a SINGLE_PRIMARY and client B connects with ALL_PRIMARY, an PARAMS_DIFFER_FROM_OTHER_CLIENTS error is returned to client B.

TODO (deepgajjar): The fake implementation does not support ALL_PRIMARY. Ignore the current tests since the return error would be UNSUPPORTED_PARAMS instead of PARAMS_DIFFER_FROM_OTHER_CLIENTS. Add tests once the support for ALL_PRIMARY comes in.

func TestSameElectionIDFromTwoClients

func TestSameElectionIDFromTwoClients(c *fluent.GRIBIClient, t testing.TB, opts ...TestOpt)

TestSameElectionIDFromTwoClients is the test to start 2 clients with same election ID. The client A should be master initially, and be replaced with client B when it connects. The AFT operation from client A should be rejected.

func TestUnsupportedElectionParams

func TestUnsupportedElectionParams(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt)

TestUnsupportedElectionParams ensures that election parameters that are invalid - currently the test covers ALL_PRIMARY and an non-nil election ID.

Types

type Test

type Test struct {
	// Fn is the function to be run for a test. Tests must not error if additional
	// TestOpt arguments are supplied to them, but silently ignore them so as to allow
	// a consistent set of options to be passed to the test suite.
	Fn func(*fluent.GRIBIClient, testing.TB, ...TestOpt)
	// Description is a longer description of what the test does such that it can
	// be handed to a documentation generating function within the test.
	Description string
	// ShortName is a short description of the test for use in test output.
	ShortName string
	// Reference is a unique reference to external data (e.g., test plans) used for the test.
	Reference string

	// RequiresFIBACK marks a test that requires the implementation of FIB ACK on the server.
	// This is expected behaviour of a gRIBI server, but some implementations add this in
	// later builds.
	RequiresFIBACK bool
	// RequiresServerReordering marks a test that requires the implementation of server-side
	// reordering of transactions rather than an immediate NACK. Currently, some implementations
	// immediately NACK forward references, which causes some tests to fail. The reference
	// implementation handles reodering.
	RequiresServerReordering bool
	// RequiresImplicitReplace marks a test that requires the implementation of AFTOperation
	// ADD for entries that already exist.
	RequiresImplicitReplace bool
	// RequiresIdempotentDelete marks a test that requires the implementation of AFTOperation
	// DELETE for entries that do not exist.
	RequiresIdempotentDelete bool
	// RequiresNonDefaultNINHG marks a test that configures NH and NHG entries (not
	// including IPv4) in non-default network-instance.
	RequiresNonDefaultNINHG bool
	// RequiresMPLS marks a test that requires MPLS support in the gRIBI server.
	RequiresMPLS bool
	// RequiresIPv6 marks a test that requires IPv6 support in the gRIBI server.
	RequiresIPv6 bool
}

Test describes a test within the compliance library.

type TestOpt

type TestOpt interface {
	// IsTestOpt marks the TestOpt as implementing this interface.
	IsTestOpt()
}

TestOpt is an option that is handed to tests that need additional parameters, each test is responsible for checking whether it is populated in the manner that it expects.

type TestSpec

type TestSpec struct {
	// In is the specification of the test to be run.
	In Test
	// FatalMsg is an expected t.Fatalf message that the test finds.
	FatalMsg string
	// ErrorMsg is an expected t.Errorf message that the test finds.
	ErrorMsg string
}

TestSpec is a description of a test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL