utils

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 15 Imported by: 21

Documentation

Overview

Package utils implements various gNMI path manipulation facilities.

Package utils implements various gNMI path manipulation facilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatInput added in v0.8.2

func FormatInput(json []byte, groups []string) string

FormatInput add 'input' and `groups` objects to the JSON Also temporarily replace `-` as OPA can't handle it

func FormatOutput added in v0.8.2

func FormatOutput(body []byte) (string, error)

FormatOutput replace the '-' back in where they were

func MatchWildcardChNameRegexp

func MatchWildcardChNameRegexp(query string, exact bool) *regexp.Regexp

MatchWildcardChNameRegexp creates a Regular Expression from a wild-carded path

func MatchWildcardRegexp

func MatchWildcardRegexp(query string, exact bool) *regexp.Regexp

MatchWildcardRegexp creates a Regular Expression from a gNMI wild-carded path This follows the gNMI wildcard syntax https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-path-conventions.md#wildcards-in-paths

func ParseGNMIElements

func ParseGNMIElements(elms []string) (*pb.Path, error)

ParseGNMIElements builds up a gnmi path, from user-supplied text

func SplitPath

func SplitPath(path string) []string

SplitPath splits a gnmi path according to the spec. See https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-path-conventions.md No validation is done. Behavior is undefined if path is an invalid gnmi path. TODO: Do validation?

func SplitPaths

func SplitPaths(paths []string) [][]string

SplitPaths splits multiple gnmi paths

func StrPath

func StrPath(path *pb.Path) string

StrPath builds a human-readable form of a gnmi path. e.g. /a/b/c[e=f]

func StrPathElem

func StrPathElem(pathElem []*pb.PathElem) string

StrPathElem builds a human-readable form of a list of path elements. e.g. /a/b/c[e=f]

func StrVal

func StrVal(val *pb.TypedValue) string

StrVal will return a string representing the supplied value

func TemporaryEvaluate added in v0.7.16

func TemporaryEvaluate(md metautils.NiceMD) error

TemporaryEvaluate - simple evaluation of rules until OpenPolicyAgent is added This is so that aether-config can be deployed to the cloud in 2021 Q1 with simple RBAC It applies to Set (gnmi) and CompactChanges(admin) and RollbackNetworkChange(admin) TODO replace the following with fine grained RBAC using OpenPolicyAgent Rego in 2021 Q2

func ToConfigName

func ToConfigName(deviceID devicetype.ID, version devicetype.Version) string

ToConfigName simply joins together device ID and version in a consistent way

func ToModelName

func ToModelName(name devicetype.Type, version devicetype.Version) string

ToModelName simply joins together model name and version in a consistent way

Types

This section is empty.

Directories

Path Synopsis
Package values implements various gNMI value manipulation facilities.
Package values implements various gNMI value manipulation facilities.

Jump to

Keyboard shortcuts

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