Documentation ¶
Index ¶
- func Run(ctx context.Context) error
- type ClientConfig
- type Core
- type CtxKeyType
- type Device
- type ErrAlreadyExists
- type ErrInvalidParameters
- type ErrInvalidTransportOptions
- type ErrInvalidTypeAssertion
- type ErrNil
- type ErrNilClient
- type ErrNotFound
- type ErrNotYetImplemented
- type ErrUnsupportedPath
- type Gnmi
- func (g *Gnmi) Capabilities(ctx context.Context) (interface{}, error)
- func (g *Gnmi) Close() error
- func (g *Gnmi) Get(ctx context.Context, params ...string) (interface{}, error)
- func (g *Gnmi) GetOptions() interface{}
- func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Schema) error
- func (g *Gnmi) Set(ctx context.Context, args ...interface{}) (interface{}, error)
- func (g *Gnmi) SetOptions(to TransportOptions)
- func (g *Gnmi) Subscribe(ctx context.Context, params ...string) error
- func (g *Gnmi) Type() string
- type GnmiTransportOptions
- type OpenConfig
- type PrincipalNetworkDomain
- type Restconf
- func (r Restconf) Get(ctx context.Context, params ...string) (interface{}, error)
- func (r Restconf) ProcessResponse(resp interface{}, root interface{}, models *ytypes.Schema) error
- func (r Restconf) Set(ctx context.Context, params ...string) (interface{}, error)
- func (r Restconf) Subscribe(ctx context.Context, params ...string) error
- func (r Restconf) Type() string
- type SouthboundInterface
- type Storable
- type Tapi
- type Transport
- type TransportOptions
- type YANGConsumer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientConfig ¶ added in v0.0.2
type ClientConfig struct { Identifier string `toml:"identifier"` Endpoint string `toml:"endpoint"` Username string `toml:"username"` Password string `toml:"password"` GjsonDefaultPath string `toml:"gjsonDefaultPath"` GjsonConnectionsPath string `toml:"gjsonConnectionsPath"` }
ClientConfig contains SBI client configuration parameters Deprecated in favor of spf viper
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core is the representation of the controllers core
type CtxKeyType ¶ added in v0.0.2
type CtxKeyType string
CtxKeyType is a custom type to be used as key in a context.WithValue() or context.Value() call. For more information see: https://www.calhoun.io/pitfalls-of-context-values-and-how-to-avoid-or-mitigate-them/
const ( // CtxKeyOpts context key for gnmi.SubscribeOptions CtxKeyOpts CtxKeyType = "opts" // CtxKeyConfig is a context key for gnmi.Config CtxKeyConfig = "config" )
type Device ¶ added in v0.0.2
type Device struct { // UUID represents the Devices UUID UUID uuid.UUID // Device inherits properties of ygot.GoStruct ygot.GoStruct // SBI is the device's southbound interface implementation SBI SouthboundInterface // Transport is the device's Transport implementation Transport Transport }
Device represents an Orchestrated Network Device (OND) which is managed by nucleus
func NewDevice ¶ added in v0.0.2
func NewDevice(sbi SouthboundInterface, opts TransportOptions) (*Device, error)
NewDevice creates a Device
type ErrAlreadyExists ¶ added in v0.0.2
type ErrAlreadyExists struct {
// contains filtered or unexported fields
}
ErrAlreadyExists implements the Error interface and is called if a specific ID of a storable item already exists.
func (*ErrAlreadyExists) Error ¶ added in v0.0.2
func (e *ErrAlreadyExists) Error() string
type ErrInvalidParameters ¶ added in v0.0.2
type ErrInvalidParameters struct {
// contains filtered or unexported fields
}
ErrInvalidParameters implements the Error interface and is called if the wrong or no parameters have been provided.
func (ErrInvalidParameters) Error ¶ added in v0.0.2
func (e ErrInvalidParameters) Error() string
type ErrInvalidTransportOptions ¶ added in v0.0.2
type ErrInvalidTransportOptions struct {
// contains filtered or unexported fields
}
ErrInvalidTransportOptions implements the Error interface and is called if the wrong TransportOptions have been provided.
func (ErrInvalidTransportOptions) Error ¶ added in v0.0.2
func (e ErrInvalidTransportOptions) Error() string
type ErrInvalidTypeAssertion ¶ added in v0.0.2
type ErrInvalidTypeAssertion struct {
// contains filtered or unexported fields
}
ErrInvalidTypeAssertion implements the Error interface and is called if the type of a storable item does not correspond to the expected type.
func (ErrInvalidTypeAssertion) Error ¶ added in v0.0.2
func (e ErrInvalidTypeAssertion) Error() string
type ErrNil ¶ added in v0.0.2
type ErrNil struct { }
ErrNil implements the Error interface and is called if a struct is nil.
type ErrNilClient ¶ added in v0.0.2
type ErrNilClient struct { }
ErrNilClient implements the Error interface and is called if a GNMI Client is nil.
func (*ErrNilClient) Error ¶ added in v0.0.2
func (e *ErrNilClient) Error() string
type ErrNotFound ¶ added in v0.0.2
type ErrNotFound struct {
// contains filtered or unexported fields
}
ErrNotFound implements the Error interface and is called if a specific ID of a storable item could not be found.
func (*ErrNotFound) Error ¶ added in v0.0.2
func (e *ErrNotFound) Error() string
type ErrNotYetImplemented ¶ added in v0.0.2
type ErrNotYetImplemented struct{}
ErrNotYetImplemented implements the Error interface and is called if a function is not implemented yet.
func (ErrNotYetImplemented) Error ¶ added in v0.0.2
func (e ErrNotYetImplemented) Error() string
type ErrUnsupportedPath ¶ added in v0.0.2
type ErrUnsupportedPath struct {
// contains filtered or unexported fields
}
ErrUnsupportedPath implements the Error interface and is called if the given path is not supported.
func (ErrUnsupportedPath) Error ¶ added in v0.0.2
func (e ErrUnsupportedPath) Error() string
type Gnmi ¶ added in v0.0.2
type Gnmi struct { SetNode func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error RespChan chan *gpb.SubscribeResponse Unmarshal func([]byte, []string, interface{}, ...ytypes.UnmarshalOpt) error Options *GnmiTransportOptions // contains filtered or unexported fields }
Gnmi implements the Transport interface and provides an SBI with the possibility to access a gNMI endpoint.
func NewGnmiTransport ¶ added in v0.0.2
func NewGnmiTransport(opts *GnmiTransportOptions) (*Gnmi, error)
NewGnmiTransport takes a struct of GnmiTransportOptions and returns a Gnmi transport based on the values of it.
func (*Gnmi) Capabilities ¶ added in v0.0.2
Capabilities calls GNMI capabilities
func (*Gnmi) Get ¶ added in v0.0.2
Get takes a slice of gnmi paths, splits them and calls get for each one of them.
func (*Gnmi) GetOptions ¶ added in v0.0.2
func (g *Gnmi) GetOptions() interface{}
GetOptions returns the Gnmi options
func (*Gnmi) ProcessResponse ¶ added in v0.0.2
ProcessResponse takes a gNMI response and serializes the contents to the root struct.
func (*Gnmi) Set ¶ added in v0.0.2
Set takes a slice of params. This slice must contain at least one operation. It can contain an additional arbitrary amount of operations and extensions.
func (*Gnmi) SetOptions ¶ added in v0.0.2
func (g *Gnmi) SetOptions(to TransportOptions)
SetOptions sets Gnmi Options
type GnmiTransportOptions ¶ added in v0.0.2
type GnmiTransportOptions struct { // all needed gnmi transport parameters gnmi.Config SetNode func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error Unmarshal func([]byte, []string, interface{}, ...ytypes.UnmarshalOpt) error RespChan chan *gpb.SubscribeResponse }
GnmiTransportOptions implements the TransportOptions interface. GnmiTransportOptions contains all needed information to setup a Gnmi transport and therefore inherits gnmi.Config.
func (*GnmiTransportOptions) GetAddress ¶ added in v0.0.2
func (gto *GnmiTransportOptions) GetAddress() string
GetAddress returns the address used by the transport to connect to a gRPC endpoint.
func (*GnmiTransportOptions) GetPassword ¶ added in v0.0.2
func (gto *GnmiTransportOptions) GetPassword() string
GetPassword returns the password used by the transport to connect to a gRPC endpoint.
func (*GnmiTransportOptions) GetUsername ¶ added in v0.0.2
func (gto *GnmiTransportOptions) GetUsername() string
GetUsername returns the username used by the transport to connect to a gRPC endpoint.
func (*GnmiTransportOptions) IsTransportOption ¶ added in v0.0.2
func (gto *GnmiTransportOptions) IsTransportOption()
IsTransportOption is needed to fulfill the requirements of the TransportOptions interface. It does not need any further implementation.
type OpenConfig ¶ added in v0.0.2
type OpenConfig struct {
// contains filtered or unexported fields
}
OpenConfig is the implementation of an OpenConfig SBI. The struct holds the YANG schema and a function that returns an SBI specific SetNode function.
func (*OpenConfig) ID ¶ added in v0.0.2
func (oc *OpenConfig) ID() uuid.UUID
ID returns the ID of the OpenConfig SBI
func (*OpenConfig) SbiIdentifier ¶ added in v0.0.2
func (oc *OpenConfig) SbiIdentifier() string
SbiIdentifier returns the string representation of the SBI deprecated
func (*OpenConfig) Schema ¶ added in v0.0.2
func (oc *OpenConfig) Schema() *ytypes.Schema
Schema returns a ygot generated openconfig Schema as ytypes.Schema
func (*OpenConfig) SetNode ¶ added in v0.0.2
func (oc *OpenConfig) SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error
SetNode injects OpenConfig specific model representation to the transport. Needed for type assertion.
func (*OpenConfig) Unmarshal ¶ added in v0.0.2
func (oc *OpenConfig) Unmarshal() func([]byte, []string, interface{}, ...ytypes.UnmarshalOpt) error
Unmarshal injects OpenConfig specific model representation to the transport. Needed for type assertion.
type PrincipalNetworkDomain ¶ added in v0.0.2
type PrincipalNetworkDomain interface { Destroy() error AddSbi(interface{}) error RemoveSbi(uuid.UUID) error AddDevice(interface{}) error RemoveDevice(uuid.UUID) error Request(uuid.UUID, string) error RequestAll(string) error GetName() string GetDescription() string MarshalDevice(uuid.UUID) (string, error) ContainsDevice(uuid.UUID) bool GetSBIs() interface{} ID() uuid.UUID }
PrincipalNetworkDomain provides an interface for PND implementations
func NewPND ¶ added in v0.0.2
func NewPND(name, description string, id uuid.UUID, sbi SouthboundInterface) (PrincipalNetworkDomain, error)
NewPND creates a Principle Network Domain
type Restconf ¶ added in v0.0.2
type Restconf struct { }
Restconf implements the Transport interface and provides an SBI with the possibility to access a Restconf endpoint.
func (Restconf) ProcessResponse ¶ added in v0.0.2
ProcessResponse not implemented yet
type SouthboundInterface ¶ added in v0.0.2
type SouthboundInterface interface { // deprecated SbiIdentifier() string // SetNode injects SBI specific model // representation to the transport. // Needed for type assertion. SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error Schema() *ytypes.Schema ID() uuid.UUID }
SouthboundInterface provides an interface for SBI implementations
type Storable ¶ added in v0.0.2
Storable provides an interface for the controller's storage architecture.
type Transport ¶ added in v0.0.2
type Transport interface { Get(ctx context.Context, params ...string) (interface{}, error) Set(ctx context.Context, params ...interface{}) (interface{}, error) Subscribe(ctx context.Context, params ...string) error Type() string GetOptions() interface{} ProcessResponse(resp interface{}, root interface{}, models *ytypes.Schema) error }
Transport provides an interface for Transport implementations like RESTCONF or gnmi
type TransportOptions ¶ added in v0.0.2
type TransportOptions interface { GetAddress() string GetUsername() string GetPassword() string IsTransportOption() }
TransportOptions provides an interface for TransportOptions implementations for Transports like RESTCONF or gNMI
type YANGConsumer ¶ added in v0.0.2
YANGConsumer is a auxillary type to redirect the response of an RESTCONF call to a ygot YANG unmarshaler