Documentation ¶
Index ¶
- func StringElementToTypedValue(s string, ls *sdcpb.LeafSchema) (*sdcpb.TypedValue, error)
- type Driver
- type TransformationContext
- type XML2sdcpbConfigAdapter
- type XMLConfigBuilder
- func (x *XMLConfigBuilder) AddElements(ctx context.Context, p *sdcpb.Path) error
- func (x *XMLConfigBuilder) AddValue(ctx context.Context, p *sdcpb.Path, v *sdcpb.TypedValue) error
- func (x *XMLConfigBuilder) Delete(ctx context.Context, p *sdcpb.Path) error
- func (x *XMLConfigBuilder) GetDoc() (string, error)
- type XMLConfigBuilderOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringElementToTypedValue ¶
func StringElementToTypedValue(s string, ls *sdcpb.LeafSchema) (*sdcpb.TypedValue, 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 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() (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 ¶
func (x *XML2sdcpbConfigAdapter) Transform(ctx context.Context, doc *etree.Document) ([]*sdcpb.Notification, error)
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 ¶
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 ¶
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 }