Documentation
¶
Index ¶
- type APIEstablisher
- func (e *APIEstablisher) UpdateConfigMap(ctx context.Context, cfg *string) error
- func (e *APIEstablisher) UpdateDeviceStatusNotReady(ctx context.Context, dDetails *ndddvrv1.DeviceDetails) error
- func (e *APIEstablisher) UpdateDeviceStatusReady(ctx context.Context, dDetails *ndddvrv1.DeviceDetails) error
- type Cache
- func (c *Cache) CheckCache(dep string) (int, string, bool)
- func (c *Cache) CheckMissingDependency(dependencies []string) bool
- func (c *Cache) GetCurrentConfig() []byte
- func (c *Cache) GetNewK8sOperatorUpdates() bool
- func (c *Cache) GetNewOnChangeUpdates() bool
- func (c *Cache) GetOnChangeDeletes() []string
- func (c *Cache) GetOnChangeDeviations() map[string]*Deviation
- func (c *Cache) GetOnChangeReApplyCache() bool
- func (c *Cache) GetOnChangeUpdates() []string
- func (c *Cache) GetParentDependencyDeleteStatus(dependencies []string) bool
- func (c *Cache) LocatePathInCache(pel []*gnmi.PathElem) (interface{}, bool, error)
- func (c *Cache) Lock()
- func (c *Cache) Request(ctx context.Context, req *netwdevpb.CacheStatusRequest) (*netwdevpb.CacheStatusReply, error)
- func (c *Cache) SetCurrentConfig(b []byte)
- func (c *Cache) SetNewK8sOperatorUpdates(b bool)
- func (c *Cache) SetNewOnChangeUpdates(b bool)
- func (c *Cache) SetOnChangeCacheUpdates(autoPilot bool, onChangeDeviations map[string]*Deviation)
- func (c *Cache) SetOnChangeReApplyCache(b bool)
- func (c *Cache) SetStatus(l int, o string, s netwdevpb.CacheStatusReply_CacheResourceStatus) error
- func (c *Cache) ShowCacheStatus()
- func (c *Cache) Unlock()
- func (c *Cache) Update(ctx context.Context, req *netwdevpb.CacheUpdateRequest) (*netwdevpb.CacheUpdateReply, error)
- func (c *Cache) UpdateLeafRefDependency(leafRefDep string)
- type Collector
- type Deviation
- type DeviceCollector
- func (c *DeviceCollector) GetSubscription(subName string) bool
- func (c *DeviceCollector) Lock()
- func (c *DeviceCollector) StartSubscription(dctx context.Context, subName string, sub []string) error
- func (c *DeviceCollector) StopSubscription(ctx context.Context, sub string) error
- func (c *DeviceCollector) Unlock()
- type DeviceDiscoverer
- type DeviceDriver
- func (d *DeviceDriver) DeletedUnwantedConfiguration(f map[string]interface{}, prefix string)
- func (d *DeviceDriver) InitDeviceDriverControllers() error
- func (d *DeviceDriver) InitGrpcServer() error
- func (d *DeviceDriver) InitSubscriptionExceptionPaths() error
- func (d *DeviceDriver) Start() error
- func (d *DeviceDriver) StartGnmiSubscriptionHandler()
- func (d *DeviceDriver) StartGrpcServer(s string) error
- func (d *DeviceDriver) StartReconcileProcess() error
- func (d *DeviceDriver) StopGrpcServer()
- func (d *DeviceDriver) UpdateLatestConfigWithGnmi() error
- type Discoverer
- type ElementKeyValue
- type Establisher
- type Option
- func WithAutoPilot(b *bool) Option
- func WithContext() Option
- func WithDebug(b *bool) Option
- func WithDeviceName(n *string) Option
- func WithEstablisher(er *APIEstablisher) Option
- func WithGrpcServer(s *string) Option
- func WithGzip(b *bool) Option
- func WithInsecure(b *bool) Option
- func WithK8sClient(c *client.Client) Option
- func WithLogger(log logging.Logger) Option
- func WithPassword(p *string) Option
- func WithSkipVerify(b *bool) Option
- func WithTLSCA(t *string) Option
- func WithTLSCert(t *string) Option
- func WithTLSKey(t *string) Option
- func WithTargetAddress(t *string) Option
- func WithTargetName(n *string) Option
- func WithTimeout(t time.Duration) Option
- func WithUsername(u *string) Option
- type Registrator
- func (r *Registrator) GetDeviceKind() string
- func (r *Registrator) GetDeviceMatch() string
- func (r *Registrator) GetExceptionPaths() []string
- func (r *Registrator) GetExplicitExceptionPaths() []string
- func (r *Registrator) GetSubscriptions() []string
- func (r *Registrator) Register(ctx context.Context, req *netwdevpb.RegistrationRequest) (*netwdevpb.RegistrationReply, error)
- type ResourceData
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIEstablisher ¶
type APIEstablisher struct {
// contains filtered or unexported fields
}
APIEstablisher establishes control or ownership of resources in the API server for a parent.
func NewAPIEstablisher ¶
func NewAPIEstablisher(client resource.ClientApplicator, log logging.Logger, deviceName, nsConfig, nsDeployment string) *APIEstablisher
NewAPIEstablisher creates a new APIEstablisher.
func (*APIEstablisher) UpdateConfigMap ¶
func (e *APIEstablisher) UpdateConfigMap(ctx context.Context, cfg *string) error
UpdateDeviceStatusReady updates a set of resources
func (*APIEstablisher) UpdateDeviceStatusNotReady ¶
func (e *APIEstablisher) UpdateDeviceStatusNotReady(ctx context.Context, dDetails *ndddvrv1.DeviceDetails) error
UpdateDeviceStatusReady updates a set of resources
func (*APIEstablisher) UpdateDeviceStatusReady ¶
func (e *APIEstablisher) UpdateDeviceStatusReady(ctx context.Context, dDetails *ndddvrv1.DeviceDetails) error
UpdateDeviceStatusReady updates a set of resources
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 }
Cache contains the
func (*Cache) CheckCache ¶
CheckCache checks if an object exists in the cache
func (*Cache) CheckMissingDependency ¶
CheckMissingDependency validates the dependencies of the path
func (*Cache) GetCurrentConfig ¶
func (*Cache) GetNewK8sOperatorUpdates ¶
func (*Cache) GetNewOnChangeUpdates ¶
func (*Cache) GetOnChangeDeletes ¶
func (*Cache) GetOnChangeDeviations ¶
func (*Cache) GetOnChangeReApplyCache ¶
func (*Cache) GetOnChangeUpdates ¶
func (*Cache) GetParentDependencyDeleteStatus ¶
func (*Cache) LocatePathInCache ¶
func (*Cache) Request ¶
func (c *Cache) Request(ctx context.Context, req *netwdevpb.CacheStatusRequest) (*netwdevpb.CacheStatusReply, error)
Request is a GRPC service that provides the cache status
func (*Cache) SetCurrentConfig ¶
func (*Cache) SetNewK8sOperatorUpdates ¶
func (*Cache) SetNewOnChangeUpdates ¶
func (*Cache) SetOnChangeCacheUpdates ¶
func (*Cache) SetOnChangeReApplyCache ¶
func (*Cache) ShowCacheStatus ¶
func (c *Cache) ShowCacheStatus()
func (*Cache) Update ¶
func (c *Cache) Update(ctx context.Context, req *netwdevpb.CacheUpdateRequest) (*netwdevpb.CacheUpdateReply, error)
Update is a GRPC service that updates the cache with new information
func (*Cache) UpdateLeafRefDependency ¶
UpdateLeafRefDependency validates and updates the leafref dependency status
type Deviation ¶
type Deviation struct { OnChangeAction netwdevpb.Deviation_OnChangeAction Pel []*gnmi.PathElem Value []byte DeviationAction netwdevpb.Deviation_DeviationAction Change bool }
type DeviceCollector ¶
type DeviceCollector struct { TargetReceiveBuffer uint RetryTimer time.Duration Target *collector.Target Subscriptions map[string]*Subscription Mutex sync.RWMutex // contains filtered or unexported fields }
func NewDeviceCollector ¶
func NewDeviceCollector(t *collector.Target, log logging.Logger) *DeviceCollector
func (*DeviceCollector) GetSubscription ¶
func (c *DeviceCollector) GetSubscription(subName string) bool
func (*DeviceCollector) Lock ¶
func (c *DeviceCollector) Lock()
func (*DeviceCollector) StartSubscription ¶
func (*DeviceCollector) StopSubscription ¶
func (c *DeviceCollector) StopSubscription(ctx context.Context, sub string) error
func (*DeviceCollector) Unlock ¶
func (c *DeviceCollector) Unlock()
type DeviceDiscoverer ¶
type DeviceDiscoverer struct {
// contains filtered or unexported fields
}
func NewDeviceDiscoverer ¶
func NewDeviceDiscoverer(target *collector.Target, log logging.Logger) *DeviceDiscoverer
func (*DeviceDiscoverer) Discover ¶
func (d *DeviceDiscoverer) Discover(ctx context.Context) (nddv1.DeviceType, error)
type DeviceDriver ¶
type DeviceDriver struct { Device devices.Device Objects Establisher Discoverer Discoverer Collector Collector GrpcServerPort *int GrpcServerAddress *string DeviceName *string TargetConfig *collector.TargetConfig Target *collector.Target K8sClient *client.Client NetworkNodeKind *string DeviceDetails *ndddvrv1.DeviceDetails InitialConfig map[string]interface{} GrpcServer *grpc.Server AutoPilot *bool Debug *bool Registrator *Registrator Cache *Cache SubCh chan bool StopCh chan struct{} Ctx context.Context // contains filtered or unexported fields }
DeviceDriver contains the device driver information
func NewDeviceDriver ¶
func NewDeviceDriver(opts ...Option) (*DeviceDriver, error)
NewDeviceDriver function defines a new device driver
func (*DeviceDriver) DeletedUnwantedConfiguration ¶
func (d *DeviceDriver) DeletedUnwantedConfiguration(f map[string]interface{}, prefix string)
func (*DeviceDriver) InitDeviceDriverControllers ¶
func (d *DeviceDriver) InitDeviceDriverControllers() error
InitDeviceDriverControllers initializes the device driver controller
func (*DeviceDriver) InitGrpcServer ¶
func (d *DeviceDriver) InitGrpcServer() error
func (*DeviceDriver) InitSubscriptionExceptionPaths ¶
func (d *DeviceDriver) InitSubscriptionExceptionPaths() error
func (*DeviceDriver) Start ¶
func (d *DeviceDriver) Start() error
func (*DeviceDriver) StartGnmiSubscriptionHandler ¶
func (d *DeviceDriver) StartGnmiSubscriptionHandler()
func (*DeviceDriver) StartGrpcServer ¶
func (d *DeviceDriver) StartGrpcServer(s string) error
StartGRPCServer starts the grpcs server
func (*DeviceDriver) StartReconcileProcess ¶
func (d *DeviceDriver) StartReconcileProcess() error
StartReconcileProcess starts the driver reconciiation process
func (*DeviceDriver) StopGrpcServer ¶
func (d *DeviceDriver) StopGrpcServer()
func (*DeviceDriver) UpdateLatestConfigWithGnmi ¶
func (d *DeviceDriver) UpdateLatestConfigWithGnmi() error
type Discoverer ¶
type Discoverer interface { // Discover discovers the device through gnmi Discover(ctx context.Context) (nddv1.DeviceType, error) }
A Discoverer discovers device kinds
type ElementKeyValue ¶
ElementKeyValue struct
type Establisher ¶
type Establisher interface { // Update device status to ready state UpdateDeviceStatusReady(ctx context.Context, dd *ndddvrv1.DeviceDetails) error // Update device status to not ready state UpdateDeviceStatusNotReady(ctx context.Context, dd *ndddvrv1.DeviceDetails) error // Update config map UpdateConfigMap(ctx context.Context, cfg *string) error }
An Establisher brings up or down a set of resources in the API server
type Option ¶
type Option func(d *DeviceDriver)
Option is a function to initialize the options of the device driver
func WithAutoPilot ¶
func WithContext ¶
func WithContext() Option
func WithDeviceName ¶
WithDeviceName initializes the device name in the device driver
func WithEstablisher ¶
func WithEstablisher(er *APIEstablisher) Option
WithEstablisher specifies how the ddriver should create/delete/update resources through the k8s api
func WithGrpcServer ¶
WithGrpcServer initializes the cache server in the device driver
func WithK8sClient ¶
WithDeviceName initializes the device name in the device driver
func WithLogger ¶
WithLogger specifies how the Reconciler should log messages.
func WithTargetAddress ¶
WithTargetAddress initializes the address in the gnmi target
func WithTargetName ¶
WithTargetName initializes the name in the gnmi target
func WithTimeout ¶
WithTimeout initializes the timeout in the protocol of the device driver
type Registrator ¶
type Registrator struct { netwdevpb.UnimplementedRegistrationServer DeviceKind string DeviceMatch string Subscriptions []string ExceptionPaths []string ExplicitExceptionPaths []string // contains filtered or unexported fields }
func NewRegistrator ¶
func NewRegistrator(log logging.Logger, subCh chan bool) *Registrator
func (*Registrator) GetDeviceKind ¶
func (r *Registrator) GetDeviceKind() string
func (*Registrator) GetDeviceMatch ¶
func (r *Registrator) GetDeviceMatch() string
func (*Registrator) GetExceptionPaths ¶
func (r *Registrator) GetExceptionPaths() []string
func (*Registrator) GetExplicitExceptionPaths ¶
func (r *Registrator) GetExplicitExceptionPaths() []string
func (*Registrator) GetSubscriptions ¶
func (r *Registrator) GetSubscriptions() []string
func (*Registrator) Register ¶
func (r *Registrator) Register(ctx context.Context, req *netwdevpb.RegistrationRequest) (*netwdevpb.RegistrationReply, error)
Request is a GRPC service that provides the cache status
type ResourceData ¶
type ResourceData struct { Config *netwdevpb.CacheUpdateRequest CacheStatus netwdevpb.CacheStatusReply_CacheResourceStatus // Status of the resource }
type Subscription ¶
type Subscription struct { StopCh chan bool CancelFn context.CancelFunc }