util

package
v1.0.2-0...-46205ac Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package util contain utility functions for doing YANG model validation.

Index

Constants

View Source
const (
	// PYANG_MSG_TEMPLATE_STRING sets up an output template for pyang using
	// its commandline option --msg-template.
	PYANG_MSG_TEMPLATE_STRING = `PYANG_MSG_TEMPLATE='messages:{{path:"{file}" line:{line} code:"{code}" type:"{type}" level:{level} message:'"'{msg}'}}"`
)

Variables

This section is empty.

Functions

func ParsePyangTextprotoOutput

func ParsePyangTextprotoOutput(textprotoOut string) (*pb.PyangOutput, error)

ParsePyangTextprotoOutput parses textproto-formatted pyang output into a proto message. It assumes that the input string has format defined by PYANG_MSG_TEMPLATE_STRING.

Types

type StandardErrorLine

type StandardErrorLine struct {
	Path    string
	LineNo  int32
	Status  string
	Message string
}

StandardErrorLine contains a parsed commandline output from pyang.

type StandardOutput

type StandardOutput struct {
	ErrorLines   []*StandardErrorLine
	WarningLines []*StandardErrorLine
	OtherLines   []string
}

StandardOutput contains the parsed commandline outputs from pyang.

func ParseStandardOutput

func ParseStandardOutput(rawOut string) StandardOutput

ParseStandardOutput parses raw pyang/confd output into a structured format. It recognizes two formats of output from pyang and confD: <file path>:<line no>:<error/warning>:<message> <file path>:<line#>(<import file path>:<line#>):<error/warning>:<message>

Jump to

Keyboard shortcuts

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