Help us shape the future of Go! Take the 2026 Go Developer Survey

netconf

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNCTarget added in v0.0.67

func NewNCTarget(_ context.Context, name string, cfg *config.SBI, runningStore types.RunningStore, schemaClient schemaClient.SchemaClientBound) (*ncTarget, error)

Types

type Driver

type Driver interface {
	// Get config or state
	Get(filter string) (*types.NetconfResponse, error)
	// GetConfig
	GetConfig(source string, filter string) (*types.NetconfResponse, error)
	// EditConfig applies to the provided configuration target (candidate|running) the xml config provided in the config parameter
	EditConfig(target string, config string) (*types.NetconfResponse, error)
	// lock a target datastore
	Lock(target string) (*types.NetconfResponse, error)
	// unlock a target datastore
	Unlock(target string) (*types.NetconfResponse, error)
	// validate a source datastore
	Validate(source string) (*types.NetconfResponse, error)
	// Commit applies the candidate changes to the running config
	Commit() error
	// discard a candidate config
	Discard() error
	// Close the connection to the device
	Close() error
	// IsAlive returns true if the underlying transport driver is still open
	IsAlive() bool
}

type GetXMLImporter added in v0.0.67

type GetXMLImporter interface {
	GetImportAdapter(ctx context.Context, req *sdcpb.GetDataRequest) (importer.ImportConfigAdapter, error)
}

type NetconfSync added in v0.0.67

type NetconfSync interface {
	Start() error
	Stop() error
}

type NetconfSyncImpl added in v0.0.67

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

func NewNetconfSyncImpl added in v0.0.67

func NewNetconfSyncImpl(ctx context.Context, targetName string, target GetXMLImporter, c *config.SyncProtocol, runningStore types.RunningStore) (*NetconfSyncImpl, error)

func (*NetconfSyncImpl) Start added in v0.0.67

func (s *NetconfSyncImpl) Start() error

func (*NetconfSyncImpl) Stop added in v0.0.67

func (s *NetconfSyncImpl) Stop() error

type TransformationContext

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

TransformationContext

func NewTransformationContext

func NewTransformationContext(pelems []*sdcpb.PathElem) *TransformationContext

func (*TransformationContext) AddLeafListEntry

func (tc *TransformationContext) AddLeafListEntry(name string, val *sdcpb.TypedValue) error

func (*TransformationContext) Close

func (tc *TransformationContext) Close() []*sdcpb.Update

Close when closing the context, updates for LeafLists will be calculated and returned

func (*TransformationContext) String

func (tc *TransformationContext) String(ctx context.Context) (result string, err error)

type XML2sdcpbConfigAdapter

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

XML2sdcpbConfigAdapter is used to transform the provided XML configuration data into the gnmi-like sdcpb.Notifications. This transformation is done via schema information acquired throughout the SchemaServerClient throughout the transformation process.

func NewXML2sdcpbConfigAdapter

func NewXML2sdcpbConfigAdapter(ssc schemaClient.SchemaClientBound) *XML2sdcpbConfigAdapter

NewXML2sdcpbConfigAdapter constructs a new XML2sdcpbConfigAdapter

func (*XML2sdcpbConfigAdapter) Transform

Transform takes an etree.Document and transforms the content into a sdcpb based Notification

type XMLConfigBuilder

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

XMLConfigBuilder is used to builds XML configuration or XML Filter documents Via the use of a sdcpb.SchemaServerClient and the *sdcpb.Schema Namespace, Key and Type information and a valid configuration or filter document can be crafted.

func NewXMLConfigBuilder

func NewXMLConfigBuilder(ssc SchemaClient.SchemaClientBound, cfgOpts *XMLConfigBuilderOpts) *XMLConfigBuilder

NewXMLConfigBuilder returns a new XMLConfigBuilder instance

func (*XMLConfigBuilder) AddElements

func (x *XMLConfigBuilder) AddElements(ctx context.Context, p *sdcpb.Path) error

AddElements add a given *sdcpb.Path p to the xml document. This will not define a terminal value under the given path. This is usefull when creating Netconf Filters where you provide an xml document pointing to branches that you're intrested in receiving.

func (*XMLConfigBuilder) AddValue

func (x *XMLConfigBuilder) AddValue(ctx context.Context, p *sdcpb.Path, v *sdcpb.TypedValue) error

AddValue adds the given *sdcpb.TypedValue v under the given *sdcpb.Path p into the xml document

func (*XMLConfigBuilder) Delete

func (x *XMLConfigBuilder) Delete(ctx context.Context, p *sdcpb.Path) error

Delete adds the given path to the XMLConfigDocument and adds the delete operation attribute ( operation="delete" ) to the last element of path p.

func (*XMLConfigBuilder) GetDoc

func (x *XMLConfigBuilder) GetDoc() (string, error)

GetDoc returns the XMLConfigBuilder generated XML document in string format.

type XMLConfigBuilderOpts

type XMLConfigBuilderOpts struct {
	// HonorNamespace if true, XML tags incorporate their namespace as an attribute.
	HonorNamespace bool
	// OperationWithNamespace if true, enables proper namespacing for the edit-config RPC operation attribute.
	OperationWithNamespace bool
	// UseOperationRemove if true, use NETCONF operation `remove` rather than `delete` in edit-config RPC.
	UseOperationRemove bool
}

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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