ops

package
v0.0.68 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorIntentNotPresent = fmt.Errorf("intent not present")
)

Functions

func AddUpdateRecursive

func AddUpdateRecursive(ctx context.Context, e api.Entry, path *sdcpb.Path, u *types.Update, flags *types.UpdateInsertFlags) (api.Entry, error)

AddUpdateRecursive recursively adds the given cache.Update to the tree. Thereby creating all the entries along the path. if the entries along th path already exist, the existing entries are called to add the Update.

func AddUpdateRecursiveInternal

func AddUpdateRecursiveInternal(ctx context.Context, s api.Entry, path *sdcpb.Path, idx int, u *types.Update, flags *types.UpdateInsertFlags) (api.Entry, error)

func CheckAndCreateKeysAsLeafs

func CheckAndCreateKeysAsLeafs(ctx context.Context, e api.Entry, intentName string, prio int32, insertFlag *types.UpdateInsertFlags) error

func ContainsOnlyDefaults

func ContainsOnlyDefaults(e api.Entry) bool

ContainsOnlyDefaults checks if the given entry is a container that only contains leafvariants with owner defaults, and that all childs are in the list of childs with defaults defined in the container schema. Containers without childs return true, while non-container entries or entries without schema return false. It returns true if the entry is a container with only default values, and false otherwise.

func DefaultValueExists

func DefaultValueExists(schema *sdcpb.SchemaElem) bool

func DefaultValueRetrieve

func DefaultValueRetrieve(ctx context.Context, schema *sdcpb.SchemaElem, path *sdcpb.Path) (*types.Update, error)

func DeleteBranch

func DeleteBranch(ctx context.Context, e api.Entry, path *sdcpb.Path, owner string) error

func FilterChilds

func FilterChilds(s api.Entry, keys map[string]string) ([]api.Entry, error)

FilterChilds returns the child entries (skipping the key entries in the tree) that match the given keys. The keys do not need to match all levels of keys, in which case the key level is considered a wildcard match (*)

func GetDeletes

func GetDeletes(e api.Entry, aggregatePaths bool) (types.DeleteEntriesList, error)

GetDeletes calculate the deletes that need to be send to the device.

func GetDeviations

func GetDeviations(ctx context.Context, e api.Entry, config *GetDeviationParams, poolFactory pool.VirtualPoolFactory) error

func GetFirstAncestorWithSchema

func GetFirstAncestorWithSchema(e api.Entry) (api.Entry, int)

GetAncestorSchema returns the schema of the parent node if the schema is set. if the parent has no schema (is a key element in the tree) it will continue up the tree. the level of traversal is indicated via the level return value

func GetHighestPrecedence

func GetHighestPrecedence(s api.Entry, onlyNewOrUpdated bool, includeDefaults bool, includeExplicitDelete bool) api.LeafVariantSlice

GetHighestPrecedence goes through the whole branch and returns the new and updated cache.Updates. These are the updated that will be send to the device.

func GetHighestPrecedenceValueOfBranch

func GetHighestPrecedenceValueOfBranch(e api.Entry, filter api.HighestPrecedenceFilter) int32

GetHighestPrecedenceValueOfBranch goes through all the child branches to find the highest precedence value (lowest priority value) for the entire branch and returns it.

func GetListChilds

func GetListChilds(e api.Entry) ([]api.Entry, error)

GetListChilds collects all the childs of the list. In the tree we store them seperated into their key branches. this is collecting all the last level key entries.

func GetOrCreateChilds

func GetOrCreateChilds(ctx context.Context, e api.Entry, path *sdcpb.Path) (api.Entry, error)

func GetPathCompletions

func GetPathCompletions(ctx context.Context, entry api.Entry, toComplete string) []string

func GetRoot

func GetRoot(e api.Entry) api.Entry

GetRoot returns the Trees Root Entry

func GetRootBasedEntryChain

func GetRootBasedEntryChain(current api.Entry) []api.Entry

GetRootBasedEntryChain returns all the entries starting from the root down to the actual Entry. The first element of the returned slice is the root, and the last element is the actual Entry.

func GetSchemaKeys

func GetSchemaKeys(e api.Entry) []string

GetSchemaKeys checks for the schema of the entry, and returns the defined keys

func HoldsLeafVariants

func HoldsLeafVariants(e api.Entry) bool

func LeafsOfOwner

func LeafsOfOwner(e api.Entry, owner string, f ...api.LeafEntryFilter) api.LeafVariantSlice

LeafsOfOwner returns the Tree content filtered by owner, whilst allowing to filter further via providing additional LeafEntryFilter

func NavigateSdcpbPath(ctx context.Context, e api.Entry, path *sdcpb.Path) (api.Entry, error)

func ToJson

func ToJson(ctx context.Context, e api.Entry, onlyNewOrUpdated bool) (any, error)

func ToJsonIETF

func ToJsonIETF(ctx context.Context, e api.Entry, onlyNewOrUpdated bool) (any, error)

func ToProtoDeletes

func ToProtoDeletes(ctx context.Context, e api.Entry) ([]*sdcpb.Path, error)

func ToProtoUpdates

func ToProtoUpdates(ctx context.Context, e api.Entry, onlyNewOrUpdated bool) ([]*sdcpb.Update, error)

func ToXML

func ToXML(ctx context.Context, e api.Entry, onlyNewOrUpdated, honorNamespace, operationWithNamespace, useOperationRemove bool) (*etree.Document, error)

ToXML yields the xml representation of the tree. Either updates only (onlyNewOrUpdated flag) or the actual view on the whole tree. If honorNamespace is set, the xml elements will carry their respective namespace attributes. If operationWithNamespace is set, the operation attributes added to the to be deleted alements will also carry the Netconf Base namespace. If useOperationRemove is set, the remove operation will be used for deletes, instead of the delete operation.

func TreeExport

func TreeExport(e api.Entry, owner string, priority int32, orphan bool) (*tree_persist.Intent, error)

Types

type GetDeviationParams

type GetDeviationParams struct {
	Ch chan<- *types.DeviationEntry
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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