dd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeviceDriver

func NewDeviceDriver(config *rest.Config, opts ...Option) (*deviceDriver, error)

NewDeviceDriver creates a new device driver.

Types

type Cache

type Cache struct {
	netwdevpb.UnimplementedCacheStatusServer
	netwdevpb.UnimplementedCacheUpdateServer

	Mutex                 sync.RWMutex
	NewK8sOperatorUpdates bool
	Data                  map[int]map[string]*ResourceData
	Levels                []int
	NewOnChangeUpdates    bool
	OnChangeReApplyCache  bool
	OnChangeDeletes       []string
	OnChangeUpdates       []string
	OnChangeDeviations    map[string]*Deviation
	CurrentConfig         []byte
	// contains filtered or unexported fields
}

func NewCache

func NewCache(opts ...CacheOption) *Cache

func (*Cache) Lock

func (c *Cache) Lock()

func (*Cache) Request

Request is a GRPC service that provides the cache status

func (*Cache) Unlock

func (c *Cache) Unlock()

func (*Cache) Update

Update is a GRPC service that updates the cache with new information

type CacheOption

type CacheOption func(*Cache)

CacheOption can be used to manipulate Options.

func WithCacheLogger

func WithCacheLogger(log logging.Logger) CacheOption

WithCacheLogger specifies how the Reconciler should log messages.

type Deviation

type Deviation struct {
	OnChangeAction  netwdevpb.Deviation_OnChangeAction
	Pel             []*gnmi.PathElem
	Value           []byte
	DeviationAction netwdevpb.Deviation_DeviationAction
	Change          bool
}

type GrpcServer

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

func NewGrpcServer

func NewGrpcServer(opts ...ServerOption) *GrpcServer

func (*GrpcServer) GetAddress

func (s *GrpcServer) GetAddress() string

func (*GrpcServer) Run

func (s *GrpcServer) Run(ctx context.Context, r *Register, c *Cache) error

func (*GrpcServer) Start

func (s *GrpcServer) Start(r *Register, c *Cache) error

StartGRPCServer starts the grpcs server

type K8sApi

type K8sApi struct {
	client.Client
	NameSpaceResource string // this is the namespace the network node resource got deployed in, used for secrets, etc
	NameSpacePoD      string // this is the namespace on which the pod runs, which is used to get/update configmap
	DeviceName        string
	// contains filtered or unexported fields
}

K8sApi is a struct to hold the information to talk to the K8s api server

func NewK8sApi

func NewK8sApi(opts ...K8sApiOption) *K8sApi

func (*K8sApi) GetCredentials

func (a *K8sApi) GetCredentials(ctx context.Context, credName string) (*string, *string, error)

GetCredentials gets the username and apssword from the secret

func (*K8sApi) GetNetworkNode

func (a *K8sApi) GetNetworkNode(ctx context.Context) (*ndrv1.NetworkNode, error)

func (*K8sApi) SetNetworkNodeStatus

func (a *K8sApi) SetNetworkNodeStatus(ctx context.Context, dDetails *ndrv1.DeviceDetails, c nddv1.Condition) error

SetNetworkNodeStatus updates the network device in not configured condition

func (*K8sApi) UpdateConfigMap

func (a *K8sApi) UpdateConfigMap(ctx context.Context, cfg *string) error

UpdateConfigMap updates the configmap with the respective data

type K8sApiOption

type K8sApiOption func(*K8sApi)

K8sApiOption can be used to manipulate Options.

func WithK8sApiClient

func WithK8sApiClient(c client.Client) K8sApiOption

WithK8sApiClient initializes the client

func WithK8sApiDeviceName

func WithK8sApiDeviceName(s string) K8sApiOption

WithClient initializes the client

func WithK8sApiLogger

func WithK8sApiLogger(log logging.Logger) K8sApiOption

WithTargetLogger specifies how the object should log messages.

func WithK8sApiNameSpace

func WithK8sApiNameSpace(s string) K8sApiOption

WithClient initializes the client

type Option

type Option func(*Options)

Option can be used to manipulate Options.

func WithAutoPilot

func WithAutoPilot(b *bool) Option

WithAutoPilot initializes the device mode of operation

func WithDebug

func WithDebug(b *bool) Option

func WithDeviceName

func WithDeviceName(n *string) Option

WithDeviceName initializes the device name in the device driver

func WithGrpcServer

func WithGrpcServer(s *string) Option

WithGrpcServer initializes the grpc server in the device driver

func WithLogger

func WithLogger(log logging.Logger) Option

WithLogger specifies how the Reconciler should log messages.

func WithNameSpace

func WithNameSpace(n *string) Option

WithNameSpace initializes the namespace the device driver uses

func WithScheme

func WithScheme(s *runtime.Scheme) Option

WithDeviceName initializes the device name in the device driver

type Options

type Options struct {
	Scheme *runtime.Scheme

	Namespace         string
	DeviceName        string
	TargetConfig      *collector.TargetConfig
	Target            *collector.Target
	CredName          string
	GrpcServerAddress string
	AutoPilot         bool

	Debug bool
	// contains filtered or unexported fields
}

type Register

type Register struct {
	register.UnimplementedRegistrationServer

	RegisteredDevices map[nddv1.DeviceType]*register.RegistrationInfo
	// contains filtered or unexported fields
}

func NewRegister

func NewRegister(opts ...RegisterOption) *Register

func (*Register) Create

func (*Register) Delete

DeRegister is a GRPC service that deregisters the device type

func (*Register) GetDeviceMatches

func (r *Register) GetDeviceMatches() map[string]nddv1.DeviceType

GetDeviceMatches returns a map indexed by matchstring with element devicetype

func (*Register) GetDeviceTypes

func (r *Register) GetDeviceTypes() []nddv1.DeviceType

GetDeviceTypes returns all devicetypes that are registered

func (*Register) GetExceptionPaths

func (r *Register) GetExceptionPaths(d nddv1.DeviceType) []string

func (*Register) GetExplicitExceptionPaths

func (r *Register) GetExplicitExceptionPaths(d nddv1.DeviceType) []string

func (*Register) GetSubscriptions

func (r *Register) GetSubscriptions(d nddv1.DeviceType) []string

func (*Register) Read

func (*Register) Update

type RegisterOption

type RegisterOption func(*Register)

RegisterOption can be used to manipulate Options.

func WithRegisterLogger

func WithRegisterLogger(log logging.Logger) RegisterOption

WithRegisterLogger specifies how the Reconciler should log messages.

type ResourceData

type ResourceData struct {
	Config      *netwdevpb.CacheUpdateRequest
	CacheStatus netwdevpb.CacheStatusReply_CacheResourceStatus // Status of the resource
}

type ServerOption

type ServerOption func(*GrpcServer)

Option can be used to manipulate Options.

func WithGrpcServerAddress

func WithGrpcServerAddress(a string) ServerOption

func WithServerLogger

func WithServerLogger(log logging.Logger) ServerOption

WithLogger specifies how the Reconciler should log messages.

type Target

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

target is a struct to hold the target configuration used to handle gnmi capabilities

func NewTarget

func NewTarget(target *collector.Target, opts ...TargetOption) *Target

func (*Target) DeviceCapabilities

func (t *Target) DeviceCapabilities(ctx context.Context) ([]*gnmi.ModelData, error)

func (*Target) GetTarget

func (t *Target) GetTarget() *collector.Target

type TargetOption

type TargetOption func(*Target)

TargetOption can be used to manipulate Options.

func WithTargetConfig

func WithTargetConfig(tc *collector.TargetConfig) TargetOption

func WithTargetLogger

func WithTargetLogger(log logging.Logger) TargetOption

WithTargetLogger specifies how the object should log messages.

Jump to

Keyboard shortcuts

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