Documentation
¶
Index ¶
- type CancelCommit
- type Commit
- type CopyConfig
- type CreateSubscription
- type Datastore
- type DefaultOperation
- type DeleteConfig
- type DiscardChanges
- type EditConfig
- type ErrorOption
- type ExtantBool
- type Filter
- type Get
- type GetConfig
- type GetConfigReply
- type GetReply
- type KillSession
- type Lock
- type OkReply
- type TestOption
- type URL
- type Unlock
- type Validate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelCommit ¶
type CancelCommit struct {
PersistID string
}
func (CancelCommit) MarshalXML ¶
func (rpc CancelCommit) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type Commit ¶
type Commit struct {
// Confirmed indicates that the commit must be confirmed with a follow-up
// commit within the confirm-timeout period (default 600 seconds). If not
// confirmed, the commit will be reverted.
//
// Device must support :confirmed-commit:1.1 capability.
Confirmed bool
// ConfirmTimeout is the time in seconds to wait before reverting a
// confirmed commit.
//
// Device must support :confirmed-commit:1.1 capability.
ConfirmTimeout int64
// Persist indicates that the confirmed commit can be persisted across
// sessions and confirmed in a different session.
//
// If Confirmed is set this expands to the <persist> element.
//
// If Confirmed is not set this expands to the <persist-id> element to
// confirm a previous commit with the same id.
PersistID string
}
Commit represents the `<commit>` operation defined in RFC6241 8.5 for committing candidate configuration to the running datastore.
func (Commit) MarshalXML ¶
type CopyConfig ¶
CopyConfig issues the `<copy-config>` operation as defined in [RFC6241 7.3] for copying an entire config to/from a source and target datastore.
A `<config>` element defining a full config can be used as the source.
If a device supports the `:url` capability than a URL object can be used for the source or target datastore.
[RFC6241 7.3] https://www.rfc-editor.org/rfc/rfc6241.html#section-7.3
func (CopyConfig) MarshalXML ¶
func (rpc CopyConfig) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type CreateSubscription ¶
type CreateSubscription struct {
// Stream indicates which notification stream to subscribe to.
// If empty, the default NETCONF stream is used.
Stream string
// Filter selects a subset of notifications.
Filter Filter
// StartTime triggers replay of notifications from the specified time.
// Requires server support for notification replay.
StartTime *time.Time
// StopTime automatically terminates the subscription at the specified time.
// Requires StartTime to be set.
StopTime *time.Time
}
CreateSubscription represents the `<create-subscription>` operation defined in RFC 5277 Section 2.1.1 for initiating a notification subscription.
The subscription will cause the server to begin sending event notifications to the client as they occur. If StartTime is specified, the server will first replay historical events from that time (if supported).
func (*CreateSubscription) MarshalXML ¶
func (rpc *CreateSubscription) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type Datastore ¶
type Datastore string
Datastore represents a NETCONF configuration datastore as defined in RFC6241 section 7.1
const ( // Running configuration datastore. Required by RFC6241 Running Datastore = "running" // Candidate configuration configuration datastore. Supported with the // `:candidate` capability defined in RFC6241 section 8.3 Candidate Datastore = "candidate" // Startup configuration configuration datastore. Supported with the // `:startup` capability defined in RFC6241 section 8.7 Startup Datastore = "startup" )
func (Datastore) MarshalXML ¶
type DefaultOperation ¶
type DefaultOperation string
DefaultOperation defines the strategies for merging configuration in a `<edit-config> operation`.
const ( // MergeConfig configuration elements are merged together at the level at // which this specified. Can be used for config elements as well as default. MergeConfig DefaultOperation = "merge" // ReplaceConfig defines that the incoming config change should replace the // existing config at the level which it is specified. This can be // specified on individual config elements or set as the default strategy. ReplaceConfig DefaultOperation = "replace" // NoneOperation indicates that no default operation should be applied and // nothing is applied to the target configuration unless there are // operations defined on the configs subelements. NoneOperation DefaultOperation = "none" )
type DeleteConfig ¶
type DeleteConfig struct {
Target Datastore
}
DeleteConfigReq represents the `<delete-config>` operation defined in RFC6241 7.4 for deleting a configuration datastore.
func (DeleteConfig) MarshalXML ¶
func (rpc DeleteConfig) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type DiscardChanges ¶
type DiscardChanges struct{}
DiscardChanges represents the `<discard-changes>` operation defined in RFC6241 8.3.4.2 for reverting the candidate configuration to the current running configuration.
This operation discards any uncommitted changes by resetting the candidate configuration with the content of the running configuration.
Device must support the `:candidate` capability.
func (DiscardChanges) MarshalXML ¶
func (rpc DiscardChanges) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type EditConfig ¶
type EditConfig struct {
Target Datastore
DefaultOperation DefaultOperation
TestOption TestOption
ErrorOption ErrorOption
Config any
}
EditConfig issues the `<edit-config>` operation defined in RFC6241 7.2 for updating an existing target config datastore.
func (EditConfig) MarshalXML ¶
func (rpc EditConfig) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type ErrorOption ¶
type ErrorOption string
ErrorOption defines the behavior when an error is encountered during a `<edit-config>` operation.
const ( // StopOnError will abort the `<edit-config>` operation on the first error. StopOnError ErrorOption = "stop-on-error" // ContinueOnError will continue to parse the configuration data even if an // error is encountered. Errors are still recorded and reported in the // reply. ContinueOnError ErrorOption = "continue-on-error" // RollbackOnError will restore the configuration back to before the // `<edit-config>` operation took place. This requires the device to // support the `:rollback-on-error` capability. RollbackOnError ErrorOption = "rollback-on-error" )
type ExtantBool ¶
type ExtantBool bool
func (ExtantBool) MarshalXML ¶
func (b ExtantBool) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*ExtantBool) UnmarshalXML ¶
func (b *ExtantBool) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Filter ¶
func SubtreeFilter ¶
SubtreeFilter creates a filter matching the provided XML structure(s). Multiple arguments are merged into a single filter element as siblings.
type Get ¶
type Get struct {
Filter Filter `xml:"filter,omitempty"`
}
func (*Get) MarshalXML ¶
type GetConfig ¶
GetConfig implements the <get-config> rpc operation defined in RFC6241 7.1. `source` is the datastore to query.
func (GetConfig) MarshalXML ¶
type GetConfigReply ¶
type GetConfigReply struct {
Config []byte
}
func (*GetConfigReply) UnmarshalXML ¶
func (r *GetConfigReply) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type KillSession ¶
type KillSession struct {
SessionID uint
}
KillSessionReq represents the `<kill-session>` operation defined in RFC6241 7.6 for terminating a NETCONF session.
func (*KillSession) MarshalXML ¶
func (rpc *KillSession) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type Lock ¶
type Lock struct {
Target Datastore
}
LockReq represents the `<lock>` operation defined in RFC6241 7.5 for locking a configuration datastore.
func (Lock) MarshalXML ¶
type OkReply ¶
type OkReply struct {
netconf.RPCReply
OK ExtantBool `xml:"ok"`
}
type TestOption ¶
type TestOption string
TestOption defines the behavior for testing configuration before applying it in a `<edit-config>` operation.
const ( // TestThenSet will validate the configuration and only if is is valid then // apply the configuration to the datastore. TestThenSet TestOption = "test-then-set" // SetOnly will not do any testing before applying it. SetOnly TestOption = "set" // Test only will validatate the incoming configuration and return the // results without modifying the underlying store. TestOnly TestOption = "test-only" )