Documentation ¶
Overview ¶
Package fluent defines a fluent-style API for a gRIBI client that can be called from testing frameworks such as ONDATRA.
Index ¶
- func IPv4Entry() *ipv4Entry
- func IPv6Entry() *ipv6Entry
- func LabelEntry() *labelEntry
- func ModifyError() *modifyError
- func NextHopEntry() *nextHopEntry
- func NextHopGroupEntry() *nextHopGroupEntry
- func OperationResult() *opResult
- type AFT
- type GRIBIClient
- func (g *GRIBIClient) Await(ctx context.Context, t testing.TB) error
- func (g *GRIBIClient) Connection() *gRIBIConnection
- func (g *GRIBIClient) Flush() *gRIBIFlush
- func (g *GRIBIClient) Get() *gRIBIGet
- func (g *GRIBIClient) Modify() *gRIBIModify
- func (g *GRIBIClient) Results(t testing.TB) []*client.OpResult
- func (g *GRIBIClient) Start(ctx context.Context, t testing.TB)
- func (g *GRIBIClient) StartSending(ctx context.Context, t testing.TB)
- func (g *GRIBIClient) Status(t testing.TB) *client.ClientStatus
- func (g *GRIBIClient) Stop(t testing.TB)
- type GRIBIEntry
- type Header
- type ModifyErrReason
- type ProgrammingResult
- type RedundancyMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelEntry ¶
func LabelEntry() *labelEntry
LabelEntry returns a builder that can be used to define a MPLS label entry in the gRIBI AFT schema.
func ModifyError ¶
func ModifyError() *modifyError
ModifyError allows a gRIBI ModifyError to be constructed.
func NextHopEntry ¶
func NextHopEntry() *nextHopEntry
NextHopEntry returns a builder that can be used to build up a NextHop within gRIBI.
func NextHopGroupEntry ¶
func NextHopGroupEntry() *nextHopGroupEntry
NextHopGroupEntry returns a builder that can be used to build up a NextHopGroup within gRIBI.
func OperationResult ¶
func OperationResult() *opResult
OperationResult is a response that is received from the gRIBI server.
Types ¶
type AFT ¶
type AFT int64
AFT is an enumerated type describing the AFTs available within gRIBI.
const ( AllAFTs AFT // IPv4 references the IPv4Entry AFT. IPv4 // NextHopGroup references the NextHopGroupEntry AFT. NextHopGroup // NextHop references the NextHop AFT. NextHop // IPv6 references the IPv6Entry AFT. IPv6 )
type GRIBIClient ¶
type GRIBIClient struct {
// contains filtered or unexported fields
}
GRIBIClient stores internal state and arguments related to the gRIBI client that is exposed by the fluent API.
func NewClient ¶
func NewClient() *GRIBIClient
NewClient returns a new gRIBI client instance, and is an entrypoint to this package.
func (*GRIBIClient) Await ¶
Await waits until the underlying gRIBI client has completed its work to return - complete is defined as both the send and pending queue being empty, or an error being hit by the client. It returns an error in the case that there were errors reported.
func (*GRIBIClient) Connection ¶
func (g *GRIBIClient) Connection() *gRIBIConnection
Connection allows any parameters relating to gRIBI connections to be set through the gRIBI fluent API.
func (*GRIBIClient) Flush ¶
func (g *GRIBIClient) Flush() *gRIBIFlush
Flush is a wrapper for the gRIBI Flush RPC which is used to remove the current entries from the active gRIBI RIB. Flush operations can be restricted based on a single network-instnace, or applied to all NIs on the server. Where the server is in SINGLE_PRIMARY mode Flush can either consider the current ID, or override it.
func (*GRIBIClient) Get ¶
func (g *GRIBIClient) Get() *gRIBIGet
Get is a wrapper for the gRIBI Get RPC which is used to retrieve the current entries that are in the active gRIBI RIB. Get returns only entries that have been succesfully installed according to the request's ACK type. It can be filtered according to network instance and AFT.
func (*GRIBIClient) Modify ¶
func (g *GRIBIClient) Modify() *gRIBIModify
Modify wraps methods that trigger operations within the gRIBI Modify RPC.
func (*GRIBIClient) Results ¶
func (g *GRIBIClient) Results(t testing.TB) []*client.OpResult
Results returns the transaction results from the client. If the client is not converged it will return a partial set of results from transactions that have completed, otherwise it will return the complete set of results received from the server.
func (*GRIBIClient) Start ¶
func (g *GRIBIClient) Start(ctx context.Context, t testing.TB)
Start connects the gRIBI client to the target using the specified context as the connection parameters. The dial to the target is blocking, so Start() will not return until a connection is successfully made. Any error in parsing the specified arguments required for connections is raised using the supplied testing.TB.
func (*GRIBIClient) StartSending ¶
func (g *GRIBIClient) StartSending(ctx context.Context, t testing.TB)
StartSending specifies that the Modify stream to the target should be made, and the client should start to send any queued messages to the target. Any error encountered is reported using the supplied testing.TB.
func (*GRIBIClient) Status ¶
func (g *GRIBIClient) Status(t testing.TB) *client.ClientStatus
Status returns the status of the client. It can be used to check whether there pending operations or whether errors have occurred in the client.
func (*GRIBIClient) Stop ¶
func (g *GRIBIClient) Stop(t testing.TB)
Stop specifies that the gRIBI client should stop sending operations, and subsequently disconnect from the server.
type GRIBIEntry ¶
type GRIBIEntry interface { // OpProto builds the entry as a new AFTOperation protobuf. OpProto() (*spb.AFTOperation, error) // EntryProto builds the entry as a new AFTEntry protobuf. EntryProto() (*spb.AFTEntry, error) }
GRIBIEntry is an entry implemented for all types that can be returned as a gRIBI entry.
type Header ¶
type Header int64
Header represents the enumerated set of headers that a packet can be encapsulated or decapsulated from.
const ( // IPinIP specifies that the header to be decpsulated is an IPv4 header, and is typically // used when IP-in-IP tunnels are created. IPinIP Header )
type ModifyErrReason ¶
type ModifyErrReason int64
ModifyErrReason is a type used to express reasons for errors within the Modify RPC.
const ( // Unsupported parameters indicates that the server does not support the client parameters. UnsupportedParameters ModifyErrReason // ModifyParamsNotAllowed indicates that the client tried to modify the parameters after they // were set. ModifyParamsNotAllowed // ParamsDiffereFromOtherClients indicates that the parameters specified are inconsistent // with other clients that are connected to the server. ParamsDifferFromOtherClients // ElectionIDNotAllowed indicates that a client tried to send an election ID in a context // within which it was not allowed. ElectionIDNotAllowed )
type ProgrammingResult ¶
type ProgrammingResult int64
ProgrammingResult is a fluent-style representation of the AFTResult Status enumeration in gRIBI.
const ( // ProgrammingFailed indicates that the entry was not installed into the // RIB or FIB, and cannot be. ProgrammingFailed ProgrammingResult = iota // InstalledInRIB indicates that the entry was installed into the RIB. It // does not guarantee that the system is using the entry, and does not // guarantee that it is in hardware. InstalledInRIB // InstalledInFIB indicates that the entry was installed into the FIB. It // indicates that the system is using the entry and it is installed in // hardware. InstalledInFIB )
type RedundancyMode ¶
type RedundancyMode int64
RedundancyMode is a type used to indicate the redundancy modes supported in gRIBI.
const ( // AllPrimaryClients indicates that all clients should be treated as a primary // and the server should do reference counting and bestpath selection between // them using the standard mechansisms defined in gRIBI. AllPrimaryClients RedundancyMode // ElectedPrimaryClient indicates that this client is treated as part of an // elected set of clients that have an external election process that assigns // a uint128 election ID. ElectedPrimaryClient )