testschema

package
v0.28.2 Latest Latest
Warning

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

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

Documentation

Overview

Package testschema 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 /usr/local/google/home/wenbli/gocode/src/github.com/openconfig/ygot4/genutil/names.go using the following YANG input files:

  • yang/testschema.yang
  • yang/refschema.yang

Imported modules were sourced from:

  • ...

Index

Constants

This section is empty.

Variables

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

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 {
	ΛMetadata []ygot.Annotation  `path:"@" ygotAnnotation:"true"`
	Ref       *Refschema_Ref     `path:"ref" module:"refschema"`
	ΛRef      []ygot.Annotation  `path:"@ref" ygotAnnotation:"true"`
	Target    *Testschema_Target `path:"target" module:"testschema"`
	ΛTarget   []ygot.Annotation  `path:"@target" ygotAnnotation:"true"`
}

Device represents the /device YANG schema element.

func (*Device) GetOrCreateRef

func (t *Device) GetOrCreateRef() *Refschema_Ref

GetOrCreateRef retrieves the value of the Ref field or returns the existing field if it already exists.

func (*Device) GetOrCreateTarget

func (t *Device) GetOrCreateTarget() *Testschema_Target

GetOrCreateTarget retrieves the value of the Target field or returns the existing field if it already exists.

func (*Device) GetRef

func (t *Device) GetRef() *Refschema_Ref

GetRef returns the value of the Ref struct pointer from Device. If the receiver or the field Ref is nil, nil is returned such that the Get* methods can be safely chained.

func (*Device) GetTarget

func (t *Device) GetTarget() *Testschema_Target

GetTarget returns the value of the Target struct pointer from Device. If the receiver or the field Target is nil, nil is returned such that the Get* methods can be safely chained.

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) ΛBelongingModule added in v0.17.0

func (*Device) ΛBelongingModule() string

ΛBelongingModule returns the name of the module that defines the namespace of Device.

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.

func (*Device) ΛValidate added in v0.18.1

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

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

type Refschema_Ref

type Refschema_Ref struct {
	ΛMetadata  []ygot.Annotation                   `path:"@" ygotAnnotation:"true"`
	Reference  map[string]*Refschema_Ref_Reference `path:"reference" module:"refschema"`
	ΛReference []ygot.Annotation                   `path:"@reference" ygotAnnotation:"true"`
}

Refschema_Ref represents the /refschema/ref YANG schema element.

func (*Refschema_Ref) AppendReference

func (t *Refschema_Ref) AppendReference(v *Refschema_Ref_Reference) error

AppendReference appends the supplied Refschema_Ref_Reference struct to the list Reference of Refschema_Ref. If the key value(s) specified in the supplied Refschema_Ref_Reference already exist in the list, an error is returned.

func (*Refschema_Ref) GetOrCreateReference

func (t *Refschema_Ref) GetOrCreateReference(Name string) *Refschema_Ref_Reference

GetOrCreateReference retrieves the value with the specified keys from the receiver Refschema_Ref. If the entry does not exist, then it is created. It returns the existing or new list member.

func (*Refschema_Ref) GetReference

func (t *Refschema_Ref) GetReference(Name string) *Refschema_Ref_Reference

GetReference retrieves the value with the specified key from the Reference map field of Refschema_Ref. If the receiver is nil, or the specified key is not present in the list, nil is returned such that Get* methods may be safely chained.

func (*Refschema_Ref) IsYANGGoStruct

func (*Refschema_Ref) IsYANGGoStruct()

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

func (*Refschema_Ref) NewReference

func (t *Refschema_Ref) NewReference(Name string) (*Refschema_Ref_Reference, error)

NewReference creates a new entry in the Reference list of the Refschema_Ref struct. The keys of the list are populated from the input arguments.

func (*Refschema_Ref) RenameReference

func (t *Refschema_Ref) RenameReference(oldK, newK string) error

RenameReference renames an entry in the list Reference within the Refschema_Ref struct. The entry with key oldK is renamed to newK updating the key within the value.

func (*Refschema_Ref) Validate

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

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

func (*Refschema_Ref) ΛBelongingModule added in v0.17.0

func (*Refschema_Ref) ΛBelongingModule() string

ΛBelongingModule returns the name of the module that defines the namespace of Refschema_Ref.

func (*Refschema_Ref) ΛEnumTypeMap

func (t *Refschema_Ref) Λ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 (*Refschema_Ref) ΛValidate added in v0.18.1

func (t *Refschema_Ref) ΛValidate(opts ...ygot.ValidationOption) error

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

type Refschema_Ref_Reference

type Refschema_Ref_Reference struct {
	ΛMetadata []ygot.Annotation `path:"@" ygotAnnotation:"true"`
	Name      *string           `path:"name" module:"refschema"`
	ΛName     []ygot.Annotation `path:"@name" ygotAnnotation:"true"`
}

Refschema_Ref_Reference represents the /refschema/ref/reference YANG schema element.

func (*Refschema_Ref_Reference) GetName

func (t *Refschema_Ref_Reference) GetName() string

GetName retrieves the value of the leaf Name from the Refschema_Ref_Reference struct. If the field is unset but has a default value in the YANG schema, then the default value will be returned. Caution should be exercised whilst using this method since when without a default value, it will return the Go zero value if the field is explicitly unset. If the caller explicitly does not care if Name is set, it can safely use t.GetName() to retrieve the value. In the case that the caller has different actions based on whether the leaf is set or unset, it should use 'if t.Name == nil' before retrieving the leaf's value.

func (*Refschema_Ref_Reference) IsYANGGoStruct

func (*Refschema_Ref_Reference) IsYANGGoStruct()

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

func (*Refschema_Ref_Reference) Validate

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

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

func (*Refschema_Ref_Reference) ΛBelongingModule added in v0.17.0

func (*Refschema_Ref_Reference) ΛBelongingModule() string

ΛBelongingModule returns the name of the module that defines the namespace of Refschema_Ref_Reference.

func (*Refschema_Ref_Reference) ΛEnumTypeMap

func (t *Refschema_Ref_Reference) Λ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 (*Refschema_Ref_Reference) ΛListKeyMap

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

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

func (*Refschema_Ref_Reference) ΛValidate added in v0.18.1

func (t *Refschema_Ref_Reference) ΛValidate(opts ...ygot.ValidationOption) error

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

type Testschema_Target

type Testschema_Target struct {
	ΛMetadata []ygot.Annotation                    `path:"@" ygotAnnotation:"true"`
	Entity    map[string]*Testschema_Target_Entity `path:"entity" module:"testschema"`
	ΛEntity   []ygot.Annotation                    `path:"@entity" ygotAnnotation:"true"`
}

Testschema_Target represents the /testschema/target YANG schema element.

func (*Testschema_Target) AppendEntity

func (t *Testschema_Target) AppendEntity(v *Testschema_Target_Entity) error

AppendEntity appends the supplied Testschema_Target_Entity struct to the list Entity of Testschema_Target. If the key value(s) specified in the supplied Testschema_Target_Entity already exist in the list, an error is returned.

func (*Testschema_Target) GetEntity

GetEntity retrieves the value with the specified key from the Entity map field of Testschema_Target. If the receiver is nil, or the specified key is not present in the list, nil is returned such that Get* methods may be safely chained.

func (*Testschema_Target) GetOrCreateEntity

func (t *Testschema_Target) GetOrCreateEntity(Name string) *Testschema_Target_Entity

GetOrCreateEntity retrieves the value with the specified keys from the receiver Testschema_Target. If the entry does not exist, then it is created. It returns the existing or new list member.

func (*Testschema_Target) IsYANGGoStruct

func (*Testschema_Target) IsYANGGoStruct()

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

func (*Testschema_Target) NewEntity

func (t *Testschema_Target) NewEntity(Name string) (*Testschema_Target_Entity, error)

NewEntity creates a new entry in the Entity list of the Testschema_Target struct. The keys of the list are populated from the input arguments.

func (*Testschema_Target) RenameEntity

func (t *Testschema_Target) RenameEntity(oldK, newK string) error

RenameEntity renames an entry in the list Entity within the Testschema_Target struct. The entry with key oldK is renamed to newK updating the key within the value.

func (*Testschema_Target) Validate

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

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

func (*Testschema_Target) ΛBelongingModule added in v0.17.0

func (*Testschema_Target) ΛBelongingModule() string

ΛBelongingModule returns the name of the module that defines the namespace of Testschema_Target.

func (*Testschema_Target) ΛEnumTypeMap

func (t *Testschema_Target) Λ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 (*Testschema_Target) ΛValidate added in v0.18.1

func (t *Testschema_Target) ΛValidate(opts ...ygot.ValidationOption) error

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

type Testschema_Target_Entity

type Testschema_Target_Entity struct {
	ΛMetadata []ygot.Annotation `path:"@" ygotAnnotation:"true"`
	Name      *string           `path:"name" module:"testschema"`
	ΛName     []ygot.Annotation `path:"@name" ygotAnnotation:"true"`
}

Testschema_Target_Entity represents the /testschema/target/entity YANG schema element.

func (*Testschema_Target_Entity) GetName

func (t *Testschema_Target_Entity) GetName() string

GetName retrieves the value of the leaf Name from the Testschema_Target_Entity struct. If the field is unset but has a default value in the YANG schema, then the default value will be returned. Caution should be exercised whilst using this method since when without a default value, it will return the Go zero value if the field is explicitly unset. If the caller explicitly does not care if Name is set, it can safely use t.GetName() to retrieve the value. In the case that the caller has different actions based on whether the leaf is set or unset, it should use 'if t.Name == nil' before retrieving the leaf's value.

func (*Testschema_Target_Entity) IsYANGGoStruct

func (*Testschema_Target_Entity) IsYANGGoStruct()

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

func (*Testschema_Target_Entity) Validate

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

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

func (*Testschema_Target_Entity) ΛBelongingModule added in v0.17.0

func (*Testschema_Target_Entity) ΛBelongingModule() string

ΛBelongingModule returns the name of the module that defines the namespace of Testschema_Target_Entity.

func (*Testschema_Target_Entity) ΛEnumTypeMap

func (t *Testschema_Target_Entity) Λ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 (*Testschema_Target_Entity) ΛListKeyMap

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

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

func (*Testschema_Target_Entity) ΛValidate added in v0.18.1

func (t *Testschema_Target_Entity) ΛValidate(opts ...ygot.ValidationOption) error

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

type UnionBool

type UnionBool bool

UnionBool is a bool type assignable to unions of which it is a subtype.

type UnionFloat64

type UnionFloat64 float64

UnionFloat64 is a float64 type assignable to unions of which it is a subtype.

type UnionInt16

type UnionInt16 int16

UnionInt16 is an int16 type assignable to unions of which it is a subtype.

type UnionInt32

type UnionInt32 int32

UnionInt32 is an int32 type assignable to unions of which it is a subtype.

type UnionInt64

type UnionInt64 int64

UnionInt64 is an int64 type assignable to unions of which it is a subtype.

type UnionInt8

type UnionInt8 int8

UnionInt8 is an int8 type assignable to unions of which it is a subtype.

type UnionString

type UnionString string

UnionString is a string type assignable to unions of which it is a subtype.

type UnionUint16

type UnionUint16 uint16

UnionUint16 is a uint16 type assignable to unions of which it is a subtype.

type UnionUint32

type UnionUint32 uint32

UnionUint32 is a uint32 type assignable to unions of which it is a subtype.

type UnionUint64

type UnionUint64 uint64

UnionUint64 is a uint64 type assignable to unions of which it is a subtype.

type UnionUint8

type UnionUint8 uint8

UnionUint8 is a uint8 type assignable to unions of which it is a subtype.

type UnionUnsupported

type UnionUnsupported struct {
	Value interface{}
}

UnionUnsupported is an interface{} wrapper type for unsupported types. It is assignable to unions of which it is a subtype.

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