types

package
Version: v0.0.0-...-fac1166 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: Apache-2.0 Imports: 7 Imported by: 1,392

Documentation

Overview

Package types provides built-in types specified in YANG RFC 6020 and types used in YDK Go APIs.

YANG Development Kit Copyright 2017 Cisco Systems. All rights reserved. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKeyToken

func AddKeyToken(attr interface{}, attrName string) string

func AddNoKeyToken

func AddNoKeyToken(ent Entity) string

func EntityDiff

func EntityDiff(ent1 Entity, ent2 Entity) map[string]StringPair

func EntityEqual

func EntityEqual(x, y Entity) bool

EntityEqual returns whether the entities x and y and their children are equal in value

func EntityToDict

func EntityToDict(entity Entity) map[string]string

func EntityToString

func EntityToString(e Entity) string

func GetAbsolutePath

func GetAbsolutePath(entity Entity) string

func GetEntityFilter

func GetEntityFilter(ent Entity) yfilter.YFilter

func GetPresenceFlag

func GetPresenceFlag(entity Entity) bool

GetPresenceFlag returns whether the presence flag of the given entity is set or not if it is a presence container

func GetRelativeEntityPath

func GetRelativeEntityPath(current_node Entity, ancestor Entity, path string) string

GetRelativeEntityPath returns the relative entity path (string)

func GetSegmentPath

func GetSegmentPath(entity Entity) string

GetSegmentPath returns the given entity's segment path

func GetYChildrenMap

func GetYChildrenMap(entity Entity) map[string]YChild

func HasDataOrFilter

func HasDataOrFilter(entity Entity) bool

HasDataOrFilter returns a bool representing whether the entity or any of its children have their data/filter set

func IsEntityCollection

func IsEntityCollection(e Entity) bool

func IsPresenceContainer

func IsPresenceContainer(entity Entity) bool

IsPresenceContainer returns if the given entity is a presence container

func IsSet

func IsSet(Filter yfilter.YFilter) bool

IsSet returns whether the given filter is set or not

func IsTopLevelEntity

func IsTopLevelEntity(entity Entity) bool

func SetAllParents

func SetAllParents(entity Entity)

Set Parent values in all children recursively

func SetEntityFilter

func SetEntityFilter(ent Entity, filter yfilter.YFilter)

func SetNontopEntityFilter

func SetNontopEntityFilter(entity Entity, filter yfilter.YFilter)

func SetParent

func SetParent(entity, parent Entity)

SetParent sets the given entity's parent to the given parent entity

func SetPresenceFlag

func SetPresenceFlag(entity Entity)

SetPresenceFlag sets the presence flag of the given entity if it is a presence container

func SetValue

func SetValue(entity Entity, valuePath string, value interface{})

SetValue sets the leaf value for given entity, valuePath, and value args

func SetYListKey

func SetYListKey(ent Entity, index int)

Types

type Bits

type Bits map[string]bool

Bits is a basic type that represents the YANG bits type

type BitsList

type BitsList struct {
	Value []map[string]bool
}

BitsList represent a list of Bits

type COpenDaylightServiceProvider

type COpenDaylightServiceProvider struct {
	Private interface{}
}

COpenDaylightServiceProvider is a service provider to be used to communicate with an OpenDaylight instance.

type CServiceProvider

type CServiceProvider struct {
	Private interface{}
}

CServiceProvider

type CodecServiceProvider

type CodecServiceProvider interface {
	Initialize(Entity)
	GetEncoding() encoding.EncodingFormat
	GetRootSchemaNode(Entity) RootSchemaNode
	GetState() *errors.State
}

CodecServiceProvider

type CommonEntityData

type CommonEntityData struct {
	// static data (internals)
	YangName       string
	BundleName     string
	ParentYangName string
	YFilter        yfilter.YFilter
	Children       *OrderedMap
	Leafs          *OrderedMap
	SegmentPath    string
	AbsolutePath   string

	CapabilitiesTable        map[string]string
	NamespaceTable           map[string]string
	BundleYangModelsLocation string

	YListKeys []string

	// dynamic data (internals)
	Parent Entity
}

CommonEntityData encapsulate common data within an Entity

type Config

type Config = EntityCollection

func NewConfig

func NewConfig(entities ...Entity) Config

type DataNode

type DataNode struct {
	Private interface{}
}

DataNode represents a containment hierarchy

type Decimal64

type Decimal64 struct {
	// contains filtered or unexported fields
}

Decimal64 represents a YANG built-in Decimal64 type

type Empty

type Empty struct {
}

Empty represents a YANG built-in Empty type

func (*Empty) String

func (e *Empty) String() string

String returns the representation of the Empty type as a string (an empty string)

type Entity

type Entity interface {
	GetEntityData() *CommonEntityData
}

Entity is a basic type that represents containers in YANG

func GetChildByName

func GetChildByName(
	entity Entity,
	childYangName string,
	segmentPath string) Entity

GetChildByName takes an Entity and returns the child Entity described by the given childYangName and segmentPath or nil if there is no match

func GetParent

func GetParent(entity Entity) Entity

GetParent returns the given entity's parent

func PathToEntity

func PathToEntity(entity Entity, absPath string) Entity

type EntityCollection

type EntityCollection struct {
	EcMap *OrderedMap
}

EntityCollection definition and methods

func EntityToCollection

func EntityToCollection(e Entity) *EntityCollection

func NewEntityCollection

func NewEntityCollection(entities ...Entity) EntityCollection

func (*EntityCollection) Add

func (ec *EntityCollection) Add(entities ...Entity)

func (*EntityCollection) Append

func (ec *EntityCollection) Append(entities []Entity)

func (*EntityCollection) Clear

func (ec *EntityCollection) Clear()

func (*EntityCollection) Entities

func (ec *EntityCollection) Entities() []Entity

func (*EntityCollection) Get

func (ec *EntityCollection) Get(key string) (Entity, bool)

func (EntityCollection) GetEntityData

func (ec EntityCollection) GetEntityData() *CommonEntityData

Implementing Entity interface

func (*EntityCollection) GetItem

func (ec *EntityCollection) GetItem(item int) Entity

func (*EntityCollection) HasKey

func (ec *EntityCollection) HasKey(key string) bool

func (*EntityCollection) Keys

func (ec *EntityCollection) Keys() []string

func (*EntityCollection) Len

func (ec *EntityCollection) Len() int

func (*EntityCollection) Pop

func (ec *EntityCollection) Pop(key string) (Entity, bool)

func (*EntityCollection) SetFilter

func (ec *EntityCollection) SetFilter(filter yfilter.YFilter)

func (*EntityCollection) String

func (ec *EntityCollection) String() string

type EntityPath

type EntityPath struct {
	Path       string
	ValuePaths []NameLeafData
}

EntityPath

func GetEntityPath

func GetEntityPath(entity Entity) EntityPath

GetEntityPath returns an EntityPath struct for the given entity

type EntitySlice

type EntitySlice []Entity

EntitySlice is a slice of entities

func (EntitySlice) Len

func (s EntitySlice) Len() int

Len returns the length of given EntitySlice

func (EntitySlice) Less

func (s EntitySlice) Less(i, j int) bool

Less returns whether the Entity at index i is less than the one at index j of the given EntitySlice

func (EntitySlice) Swap

func (s EntitySlice) Swap(i, j int)

Swap swaps the Entities at indices i and j of the given EntitySlice

type Enum

type Enum struct {
	EnumYLeaf
}

Enum represents a YANG built-in enum type, a base type for all YDK enums.

type EnumYLeaf

type EnumYLeaf struct {
	// contains filtered or unexported fields
}

EnumYLeaf represents variable data

type Filter

type Filter = EntityCollection

func NewFilter

func NewFilter(entities ...Entity) Filter

type LeafData

type LeafData struct {
	Value  string
	Filter yfilter.YFilter
	IsSet  bool
}

LeafData represents the data contained in a YANG leaf

type NameLeafData

type NameLeafData struct {
	Name string
	Data LeafData
}

NameLeafData represents a YANG leaf to which a name and data can be assigned

type OrderedMap

type OrderedMap struct {
	// contains filtered or unexported fields
}

Ordered Map

func NewOrderedMap

func NewOrderedMap() *OrderedMap

func (*OrderedMap) Append

func (om *OrderedMap) Append(key string, value interface{})

func (*OrderedMap) Get

func (om *OrderedMap) Get(key string) (interface{}, bool)

func (*OrderedMap) Keys

func (om *OrderedMap) Keys() []string

func (*OrderedMap) Len

func (om *OrderedMap) Len() int

func (*OrderedMap) Map

func (om *OrderedMap) Map() map[string]interface{}

func (*OrderedMap) Pop

func (om *OrderedMap) Pop(key string) (interface{}, bool)

func (*OrderedMap) Values

func (om *OrderedMap) Values() []interface{}

type Repository

type Repository struct {
	Path    string
	Private interface{}
}

Repository represents the Repository of YANG models. A instance of the Repository will be used to create a RootSchemaNode given a set of ©pabilities. Behind the scenes the repository is responsible for loading and parsing the YANG modules and creating the SchemaNode tree.

type RootSchemaNode

type RootSchemaNode struct {
	Private interface{}
}

RootSchemaNode represents the root of the SchemaTree. It can be used to instantiate a DataNode tree or an Rpc object. The children of the RootSchemaNode represent the top level SchemaNode in the YANG module submodules.

type Rpc

type Rpc struct {
	Input   DataNode
	Private interface{}
}

type ServiceProvider

type ServiceProvider interface {
	GetPrivate() interface{}
	Connect()
	Disconnect()
	GetState() *errors.State
	ExecuteRpc(string, Entity, map[string]string) DataNode
}

ServiceProvider

type Session

type Session struct {
	Private interface{}
}

type StringPair

type StringPair struct {
	Left  string
	Right string
}

type YChild

type YChild struct {
	GoName string
	Value  Entity
}

YChild encapsulates the GoName of an entity as well as the entity itself

func GetYChild

func GetYChild(entityData *CommonEntityData, name string) (YChild, bool)

func GetYChildren

func GetYChildren(entityData *CommonEntityData) []YChild

type YLeaf

type YLeaf struct {
	GoName string
	Value  interface{}
}

YLeaf encapsulates the GoName of a leaf as well as the leaf itself

func GetYLeafs

func GetYLeafs(entityData *CommonEntityData) []YLeaf

Source Files

Directories

Path Synopsis
Package datastore provides support for the DataStore type.
Package datastore provides support for the DataStore type.
Package encodingformat provides support for the EncodingFormat type.
Package encodingformat provides support for the EncodingFormat type.
Package protocol provides support for the Protocol type.
Package protocol provides support for the Protocol type.
Package yfilter can be used to include the various operations supported in the Netconf protocol’s edit-config RPC in your YDK app.
Package yfilter can be used to include the various operations supported in the Netconf protocol’s edit-config RPC in your YDK app.
Package types provides built-in types specified in YANG RFC 6020 and types used in YDK Go APIs.
Package types provides built-in types specified in YANG RFC 6020 and types used in YDK Go APIs.
Package ytype provides support for YANG builtin types.
Package ytype provides support for YANG builtin types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL