Documentation ¶
Overview ¶
Package reconciler reconciles the contents of two gRIBI RIBs -- the intended RIB is assumed to contain the desired RIB entries, whereas the 'target' RIB is to be programmed. The reconciler:
- Uses the messages that are returned from the `Get` RPC to build the contents of an external RIB.
- Calculates a diff between the two RIBs.
- Sends gRIBI operations to the target RIB to make it consistent with the intended RIB.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalRIB ¶
type LocalRIB struct {
// contains filtered or unexported fields
}
LocalRIB wraps a RIB that is locally available on the system as a gRIBIgo RIB type.
func NewLocalRIB ¶
NewLocalRIB returns a new LocalRIB instance.
type Ops ¶
type Ops struct { // NH stores the next-hop operations in the operation set. NH []*spb.AFTOperation // NHG stores the next-hop-group operations in the operation set. NHG []*spb.AFTOperation // TopLevel stores the IPv4, IPv6, and MPLS operations in the operation set. TopLevel []*spb.AFTOperation }
Ops stores a set of operations with their corresponding types. Operations are stored as NH (nexthop), NHG (next-hop-group) and top-level (MPLS, IPv4, IPv6). This allows a gRIBI client to sequence the Ops suitably.
func (*Ops) DeepCopy ¶
DeepCopy returns a deep copy (including cloning protobufs) of the specified operations.
type R ¶
type R struct {
// contains filtered or unexported fields
}
func (*R) Reconcile ¶
Reconcile calculates the required gRIBI actions to institute a reconciliation operation between the intended and remote RIB. The specified ID is used as the base for the operation ID within gRIBI. Reconcile returns a set of operations in the form of a ReconcileOps struct.
Within the returned ReconcileOps:
- The Add field indicates entries that are to be newly added to the remote RIB.
- The Replace field indicates entries that are replacing entries within the remote RIB, the replaces will be implicit (i.e., expressed as gRIBI ADD operations) unless the ExplicitReplace option is provided.
- The Delete field indicates entries that are to be deleted from the remote RIB.
Within each of these fields, entries are broken down into "top-level" entries which are from the IPv4, IPv6, or MPLS AFTs, and those that correspond to next-hop-group (NHG) or next-hop (NH) entries. This allows the client receiving these entries to enqueue them in the correct order to ensure that there are no forward references, and implement make-before-break.
type RIBTarget ¶
type RIBTarget interface { // Get returns a RIB containing all network-instances and AFTs that are // supported by the RIB. Get(context.Context) (*rib.RIB, error) // CleanUp is called to indicate that the RIBTarget should remove any // state or external connections as it is no longer required. CleanUp() }
RIBTarget is an interface that abstracts a local and remote RIB in the reconciler. It allows the RIB contents to be retrieved and programmed either via gRIBI or from a local RIB cache.
type ReconcileOps ¶
type ReconcileOps struct { // Add stores the operations that are explicitly adding new entries. Add *Ops // Replace stores the operations that are implicit or explicit replaces of // existing entries. Replace *Ops // Delete stores the operations that are removing entries. Delete *Ops }
ReconcileOps stores the operations that are required for a specific reconciliation run.
func NewReconcileOps ¶
func NewReconcileOps() *ReconcileOps
NewReconcileOps returns a new reconcileOps struct with the fields initialised.
func (*ReconcileOps) DeepCopy ¶
func (r *ReconcileOps) DeepCopy() *ReconcileOps
DeepCopy returns a copy of a reconcile ops struct, making a deep copy of all of the fields, including cloning protobufs.
func (*ReconcileOps) IsEmpty ¶
func (r *ReconcileOps) IsEmpty() bool
IsEmpty determines whether the specified ReconcileOps contains any operations.
func (*ReconcileOps) Merge ¶
func (r *ReconcileOps) Merge(in *ReconcileOps)
Merge adds the operations from the "in" operations to the receiver operations.
type RemoteRIB ¶
type RemoteRIB struct {
// contains filtered or unexported fields
}
RemoteRIB implements the RIBTarget interface and wraps a remote gRIBI RIB. The contents are accessed via the gRIBI gRPC API.
func NewRemoteRIB ¶
NewRemoteRIB returns a new remote gRIBI RIB. The context supplied is used to dial the remote gRIBI server at the address 'addr'. the 'defName' argument is used to identify the name of the default network instance on the server.
func NewRemoteRIBWithStub ¶
func NewRemoteRIBWithStub(defName string, stub spb.GRIBIClient) (*RemoteRIB, error)
NewRemoteRIBWithStub creates a new remote RIB using the specified default network instance name, and the provided stub client. It returns an error if the client cannot be created.