common

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetconfNS       = "urn:ietf:params:xml:ns:netconf:base:1.0"
	NetconfNotifyNS = "urn:ietf:params:xml:ns:netconf:notification:1.0"
	CapBase10       = "urn:ietf:params:netconf:base:1.0"
	CapBase11       = "urn:ietf:params:netconf:base:1.1"
	CapXpath        = "urn:ietf:params:netconf:capability:xpath:1.0"
)

Define netconf URNs.

Variables

View Source
var (
	NameHello        = xml.Name{Space: NetconfNS, Local: "hello"}
	NameRPC          = xml.Name{Space: NetconfNS, Local: "rpc"}
	NameRPCReply     = xml.Name{Space: NetconfNS, Local: "rpc-reply"}
	NameNotification = xml.Name{Space: NetconfNotifyNS, Local: "notification"}
)

Define xml names for different netconf messages.

View Source
var DefaultCapabilities = []string{
	CapBase10,
	CapBase11,
	CapXpath,
}

DefaultCapabilities sets the default capabilities of the client library

View Source
var NoChunkedCodecCapabilities = []string{
	CapBase10,
	CapXpath,
}

NoChunkedCodecCapabilities sets omits chunked codec capability.

Functions

func PeerSupportsChunkedFraming

func PeerSupportsChunkedFraming(caps []string) bool

PeerSupportsChunkedFraming returns true if capability list indicates support for chunked framing.

Types

type HelloMessage

type HelloMessage struct {
	XMLName      xml.Name `xml:"urn:ietf:params:xml:ns:netconf:base:1.0 hello"`
	Capabilities []string `xml:"capabilities>capability"`
	SessionID    uint64   `xml:"session-id,omitempty"`
}

HelloMessage defines the message sent/received during session negotiation.

type Notification

type Notification struct {
	XMLName   xml.Name
	EventTime string
	Event     string `xml:",innerxml"`
}

Notification defines a specific notification event.

type NotificationMessage

type NotificationMessage struct {
	XMLName   xml.Name     // `xml:"notification"`
	EventTime string       `xml:"eventTime"`
	Event     Notification `xml:",any"`
}

NotificationMessage defines the notification message sent from the server.

type RPCError

type RPCError struct {
	Type     string `xml:"error-type"`
	Tag      string `xml:"error-tag"`
	Severity string `xml:"error-severity"`
	Path     string `xml:"error-path"`
	Message  string `xml:"error-message"`
	Info     string `xml:",innerxml"`
}

RPCError defines an error reply to a RPC request

func (*RPCError) Error

func (re *RPCError) Error() string

Error generates a string representation of the RPC error

type RPCMessage

type RPCMessage struct {
	XMLName   xml.Name `xml:"urn:ietf:params:xml:ns:netconf:base:1.0 rpc"`
	MessageID string   `xml:"message-id,attr"`
	*Union
}

RPCMessage defines an rpc request message

type RPCReply

type RPCReply struct {
	XMLName   xml.Name   `xml:"rpc-reply"`
	Errors    []RPCError `xml:"rpc-error,omitempty"`
	Data      string     `xml:",innerxml"`
	Ok        bool       `xml:",omitempty"`
	RawReply  string     `xml:"-"`
	MessageID string     `xml:"message-id,attr"`
}

RPCReply defines the an rpc request message

type Request

type Request interface{}

Request represents the body of a Netconf RPC request.

type Union added in v2.1.0

type Union struct {
	ValueStr interface{}
	ValueXML string `xml:",innerxml"`
}

func GetUnion added in v2.1.0

func GetUnion(s interface{}) *Union

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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