yang

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package yang is a generated package which contains definitions of structs which represent a YANG schema. The generated schema can be compressed by a series of transformations (compression was false in this case).

This package was generated by /Users/mk/go/pkg/mod/github.com/openconfig/ygot@v0.10.0/genutil/names.go using the following YANG input files:

  • test.yang

Imported modules were sourced from:

Index

Constants

This section is empty.

Variables

View Source
var (
	SchemaTree map[string]*yang.Entry
)
View Source
var ΛEnumTypes = map[string][]reflect.Type{}

ΛEnumTypes is a map, keyed by a YANG schema path, of the enumerated types that correspond with the leaf. The type is represented as a reflect.Type. The naming of the map ensures that there are no clashes with valid YANG identifiers.

Functions

func Schema

func Schema() (*ytypes.Schema, error)

Schema returns the details of the generated schema.

func Unmarshal

func Unmarshal(data []byte, destStruct ygot.GoStruct, opts ...ytypes.UnmarshalOpt) error

Unmarshal unmarshals data, which must be RFC7951 JSON format, into destStruct, which must be non-nil and the correct GoStruct type. It returns an error if the destStruct is not found in the schema or the data cannot be unmarshaled. The supplied options (opts) are used to control the behaviour of the unmarshal function - for example, determining whether errors are thrown for unknown fields in the input JSON.

func UnzipSchema

func UnzipSchema() (map[string]*yang.Entry, error)

UnzipSchema unzips the zipped schema and returns a map of yang.Entry nodes, keyed by the name of the struct that the yang.Entry describes the schema for.

Types

type Binary

type Binary []byte

Binary is a type that is used for fields that have a YANG type of binary. It is used such that binary fields can be distinguished from leaf-lists of uint8s (which are mapped to []uint8, equivalent to []byte in reflection).

type Device

type Device struct {
	Container1 *Test_Container1 `path:"container1" module:"test"`
	Container2 *Test_Container2 `path:"container2" module:"test"`
}

Device represents the /device YANG schema element.

func (*Device) IsYANGGoStruct

func (*Device) IsYANGGoStruct()

IsYANGGoStruct ensures that Device implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.

func (*Device) Validate

func (t *Device) Validate(opts ...ygot.ValidationOption) error

Validate validates s against the YANG schema corresponding to its type.

func (*Device) ΛEnumTypeMap

func (t *Device) ΛEnumTypeMap() map[string][]reflect.Type

ΛEnumTypeMap returns a map, keyed by YANG schema path, of the enumerated types that are included in the generated code.

type Test_Container1

type Test_Container1 struct {
	List1 map[string]*Test_Container1_List1 `path:"list1" module:"test"`
}

Test_Container1 represents the /test/container1 YANG schema element.

func (*Test_Container1) IsYANGGoStruct

func (*Test_Container1) IsYANGGoStruct()

IsYANGGoStruct ensures that Test_Container1 implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.

func (*Test_Container1) NewList1

func (t *Test_Container1) NewList1(Leaf1 string) (*Test_Container1_List1, error)

NewList1 creates a new entry in the List1 list of the Test_Container1 struct. The keys of the list are populated from the input arguments.

func (*Test_Container1) Validate

func (t *Test_Container1) Validate(opts ...ygot.ValidationOption) error

Validate validates s against the YANG schema corresponding to its type.

func (*Test_Container1) ΛEnumTypeMap

func (t *Test_Container1) ΛEnumTypeMap() map[string][]reflect.Type

ΛEnumTypeMap returns a map, keyed by YANG schema path, of the enumerated types that are included in the generated code.

type Test_Container1_List1

type Test_Container1_List1 struct {
	LeafList1 []string `path:"leaf-list1" module:"test"`
	Leaf1     *string  `path:"leaf1" module:"test"`
	Leaf2     *string  `path:"leaf2" module:"test"`
}

Test_Container1_List1 represents the /test/container1/list1 YANG schema element.

func (*Test_Container1_List1) IsYANGGoStruct

func (*Test_Container1_List1) IsYANGGoStruct()

IsYANGGoStruct ensures that Test_Container1_List1 implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.

func (*Test_Container1_List1) Validate

func (t *Test_Container1_List1) Validate(opts ...ygot.ValidationOption) error

Validate validates s against the YANG schema corresponding to its type.

func (*Test_Container1_List1) ΛEnumTypeMap

func (t *Test_Container1_List1) ΛEnumTypeMap() map[string][]reflect.Type

ΛEnumTypeMap returns a map, keyed by YANG schema path, of the enumerated types that are included in the generated code.

func (*Test_Container1_List1) ΛListKeyMap

func (t *Test_Container1_List1) ΛListKeyMap() (map[string]interface{}, error)

ΛListKeyMap returns the keys of the Test_Container1_List1 struct, which is a YANG list entry.

type Test_Container2

type Test_Container2 struct {
	List1 map[string]*Test_Container2_List1 `path:"list1" module:"test"`
}

Test_Container2 represents the /test/container2 YANG schema element.

func (*Test_Container2) IsYANGGoStruct

func (*Test_Container2) IsYANGGoStruct()

IsYANGGoStruct ensures that Test_Container2 implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.

func (*Test_Container2) NewList1

func (t *Test_Container2) NewList1(Leaf1 string) (*Test_Container2_List1, error)

NewList1 creates a new entry in the List1 list of the Test_Container2 struct. The keys of the list are populated from the input arguments.

func (*Test_Container2) Validate

func (t *Test_Container2) Validate(opts ...ygot.ValidationOption) error

Validate validates s against the YANG schema corresponding to its type.

func (*Test_Container2) ΛEnumTypeMap

func (t *Test_Container2) ΛEnumTypeMap() map[string][]reflect.Type

ΛEnumTypeMap returns a map, keyed by YANG schema path, of the enumerated types that are included in the generated code.

type Test_Container2_List1

type Test_Container2_List1 struct {
	LeafList1 []string `path:"leaf-list1" module:"test"`
	Leaf1     *string  `path:"leaf1" module:"test"`
	Leaf2     *string  `path:"leaf2" module:"test"`
}

Test_Container2_List1 represents the /test/container2/list1 YANG schema element.

func (*Test_Container2_List1) IsYANGGoStruct

func (*Test_Container2_List1) IsYANGGoStruct()

IsYANGGoStruct ensures that Test_Container2_List1 implements the yang.GoStruct interface. This allows functions that need to handle this struct to identify it as being generated by ygen.

func (*Test_Container2_List1) Validate

func (t *Test_Container2_List1) Validate(opts ...ygot.ValidationOption) error

Validate validates s against the YANG schema corresponding to its type.

func (*Test_Container2_List1) ΛEnumTypeMap

func (t *Test_Container2_List1) ΛEnumTypeMap() map[string][]reflect.Type

ΛEnumTypeMap returns a map, keyed by YANG schema path, of the enumerated types that are included in the generated code.

func (*Test_Container2_List1) ΛListKeyMap

func (t *Test_Container2_List1) ΛListKeyMap() (map[string]interface{}, error)

ΛListKeyMap returns the keys of the Test_Container2_List1 struct, which is a YANG list entry.

type YANGEmpty

type YANGEmpty bool

YANGEmpty is a type that is used for fields that have a YANG type of empty. It is used such that empty fields can be distinguished from boolean fields in the generated code.

Jump to

Keyboard shortcuts

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