controller

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPortConfig

func GetPortConfig(devModel string, ssid string, psk string) string

GetPortConfig returns PortConfig overwrite

func VersionIncrement

func VersionIncrement(configOld []byte) ([]byte, error)

VersionIncrement use []byte with config.EdgeDevConfig and increment config version

Types

type Cloud

type Cloud interface {
	Controller
	AddDevice(devUUID uuid.UUID) (dev *device.Ctx, err error)
	GetEdgeNode(name string) *device.Ctx
	GetDeviceUUID(devUUID uuid.UUID) (dev *device.Ctx, err error)
	GetBaseOSConfig(id string) (baseOSConfig *config.BaseOSConfig, err error)
	ListBaseOSConfig() []*config.BaseOSConfig
	AddBaseOsConfig(baseOSConfig *config.BaseOSConfig) error
	RemoveBaseOsConfig(id string) error
	AddDataStore(dataStoreConfig *config.DatastoreConfig) error
	GetDataStore(id string) (ds *config.DatastoreConfig, err error)
	RemoveDataStore(id string) error
	ListDataStore() []*config.DatastoreConfig
	GetNetworkInstanceConfig(id string) (networkInstanceConfig *config.NetworkInstanceConfig, err error)
	AddNetworkInstanceConfig(networkInstanceConfig *config.NetworkInstanceConfig) error
	ListNetworkInstanceConfig() []*config.NetworkInstanceConfig
	RemoveNetworkInstanceConfig(id string) error
	GetImage(id string) (image *config.Image, err error)
	AddImage(imageConfig *config.Image) error
	RemoveImage(id string) error
	ListImage() []*config.Image
	GetContentTree(id string) (image *config.ContentTree, err error)
	AddContentTree(contentTreeConfig *config.ContentTree) error
	RemoveContentTree(id string) error
	ListContentTree() []*config.ContentTree
	GetVolume(id string) (image *config.Volume, err error)
	AddVolume(volumeConfig *config.Volume) error
	RemoveVolume(id string) error
	ListVolume() []*config.Volume
	GetConfigBytes(dev *device.Ctx, pretty bool) ([]byte, error)
	GetDeviceCurrent() (dev *device.Ctx, err error)
	ConfigSync(dev *device.Ctx) (err error)
	ConfigParse(config *config.EdgeDevConfig) (dev *device.Ctx, err error)
	GetNetworkConfig(id string) (networkConfig *config.NetworkConfig, err error)
	AddNetworkConfig(networkInstanceConfig *config.NetworkConfig) error
	RemoveNetworkConfig(id string) error
	GetPhysicalIO(id string) (physicalIO *config.PhysicalIO, err error)
	AddPhysicalIO(id string, physicalIO *config.PhysicalIO) error
	RemovePhysicalIO(id string) error
	GetSystemAdapter(id string) (systemAdapter *config.SystemAdapter, err error)
	AddSystemAdapter(id string, systemAdapter *config.SystemAdapter) error
	RemoveSystemAdapter(id string) error
	GetDevModel(devModelType DevModelType) (*DevModel, error)
	GetDevModelByName(devModelType string) (*DevModel, error)
	CreateDevModel(PhysicalIOs []*config.PhysicalIO, Networks []*config.NetworkConfig, Adapters []*config.SystemAdapter, AdapterForSwitches []string, modelType DevModelType) *DevModel
	ApplyDevModel(dev *device.Ctx, devModel *DevModel) error
	GetApplicationInstanceConfig(id string) (applicationInstanceConfig *config.AppInstanceConfig, err error)
	AddApplicationInstanceConfig(applicationInstanceConfig *config.AppInstanceConfig) error
	RemoveApplicationInstanceConfig(id string) error
	ListApplicationInstanceConfig() []*config.AppInstanceConfig
	StateUpdate(dev *device.Ctx) (err error)
	OnBoardDev(node *device.Ctx) error
	GetVars() *utils.ConfigVars
	SetVars(*utils.ConfigVars)
	GetAllNodes()
}

Cloud is an interface of cloud

func CloudPrepare

func CloudPrepare() (Cloud, error)

CloudPrepare is for init controller connection and obtain device list

type CloudCtx

type CloudCtx struct {
	Controller
	// contains filtered or unexported fields
}

CloudCtx is struct for use with controller

func (*CloudCtx) AddApplicationInstanceConfig

func (cloud *CloudCtx) AddApplicationInstanceConfig(applicationInstanceConfig *config.AppInstanceConfig) error

AddApplicationInstanceConfig add AppInstanceConfig config to cloud

func (*CloudCtx) AddBaseOsConfig

func (cloud *CloudCtx) AddBaseOsConfig(baseOSConfig *config.BaseOSConfig) error

AddBaseOsConfig add baseOS config to cloud

func (*CloudCtx) AddContentTree

func (cloud *CloudCtx) AddContentTree(contentTree *config.ContentTree) error

AddContentTree add ContentTree config to cloud

func (*CloudCtx) AddDataStore

func (cloud *CloudCtx) AddDataStore(dataStoreConfig *config.DatastoreConfig) error

AddDataStore add DataStore config to cloud

func (*CloudCtx) AddDevice

func (cloud *CloudCtx) AddDevice(devUUID uuid.UUID) (dev *device.Ctx, err error)

AddDevice add device with specified devUUID

func (*CloudCtx) AddImage

func (cloud *CloudCtx) AddImage(imageConfig *config.Image) error

AddImage add Image config to cloud

func (*CloudCtx) AddNetworkConfig

func (cloud *CloudCtx) AddNetworkConfig(networkConfig *config.NetworkConfig) error

AddNetworkConfig add NetworkConfig config to cloud

func (*CloudCtx) AddNetworkInstanceConfig

func (cloud *CloudCtx) AddNetworkInstanceConfig(networkInstanceConfig *config.NetworkInstanceConfig) error

AddNetworkInstanceConfig add NetworkInstance config to cloud

func (*CloudCtx) AddPhysicalIO

func (cloud *CloudCtx) AddPhysicalIO(id string, physicalIO *config.PhysicalIO) error

AddPhysicalIO add PhysicalIO config to cloud

func (*CloudCtx) AddSystemAdapter

func (cloud *CloudCtx) AddSystemAdapter(id string, systemAdapter *config.SystemAdapter) error

AddSystemAdapter add SystemAdapter config to cloud

func (*CloudCtx) AddVolume

func (cloud *CloudCtx) AddVolume(volume *config.Volume) error

AddVolume add Volume config to cloud

func (*CloudCtx) ApplyDevModel

func (cloud *CloudCtx) ApplyDevModel(dev *device.Ctx, devModel *DevModel) error

ApplyDevModel apply networks, adapters and physicalIOs from DevModel to device

func (*CloudCtx) ConfigParse

func (cloud *CloudCtx) ConfigParse(config *config.EdgeDevConfig) (device *device.Ctx, err error)

ConfigParse load config into cloud

func (*CloudCtx) ConfigSync

func (cloud *CloudCtx) ConfigSync(dev *device.Ctx) (err error)

ConfigSync set config for devID

func (*CloudCtx) CreateDevModel

func (cloud *CloudCtx) CreateDevModel(PhysicalIOs []*config.PhysicalIO, Networks []*config.NetworkConfig, Adapters []*config.SystemAdapter, AdapterForSwitches []string, modelType DevModelType) *DevModel

CreateDevModel create manual DevModel with provided params

func (*CloudCtx) GetAllNodes

func (cloud *CloudCtx) GetAllNodes()

GetAllNodes obtains all devices from controller

func (*CloudCtx) GetApplicationInstanceConfig

func (cloud *CloudCtx) GetApplicationInstanceConfig(id string) (applicationInstanceConfig *config.AppInstanceConfig, err error)

GetApplicationInstanceConfig return AppInstanceConfig config from cloud by ID

func (*CloudCtx) GetBaseOSConfig

func (cloud *CloudCtx) GetBaseOSConfig(id string) (baseOSConfig *config.BaseOSConfig, err error)

GetBaseOSConfig return baseOS config from cloud by ID

func (*CloudCtx) GetConfigBytes

func (cloud *CloudCtx) GetConfigBytes(dev *device.Ctx, pretty bool) ([]byte, error)

GetConfigBytes generate json representation of device config

func (*CloudCtx) GetContentTree

func (cloud *CloudCtx) GetContentTree(id string) (contentTree *config.ContentTree, err error)

GetContentTree return ContentTree config from cloud by ID

func (*CloudCtx) GetDataStore

func (cloud *CloudCtx) GetDataStore(id string) (ds *config.DatastoreConfig, err error)

GetDataStore return DataStore config from cloud by ID

func (*CloudCtx) GetDevModel

func (cloud *CloudCtx) GetDevModel(devModelType DevModelType) (*DevModel, error)

GetDevModel return DevModel object by DevModelType

func (*CloudCtx) GetDevModelByName

func (cloud *CloudCtx) GetDevModelByName(devModelType string) (*DevModel, error)

GetDevModelByName return DevModel object by DevModelType string

func (*CloudCtx) GetDeviceCurrent

func (cloud *CloudCtx) GetDeviceCurrent() (dev *device.Ctx, err error)

GetDeviceCurrent return current device object

func (*CloudCtx) GetDeviceUUID

func (cloud *CloudCtx) GetDeviceUUID(devUUID uuid.UUID) (dev *device.Ctx, err error)

GetDeviceUUID return device object by devUUID

func (*CloudCtx) GetEdgeNode

func (cloud *CloudCtx) GetEdgeNode(name string) *device.Ctx

GetEdgeNode by name

func (*CloudCtx) GetImage

func (cloud *CloudCtx) GetImage(id string) (image *config.Image, err error)

GetImage return Image config from cloud by ID

func (*CloudCtx) GetNetworkConfig

func (cloud *CloudCtx) GetNetworkConfig(id string) (networkConfig *config.NetworkConfig, err error)

GetNetworkConfig return NetworkConfig config from cloud by ID

func (*CloudCtx) GetNetworkInstanceConfig

func (cloud *CloudCtx) GetNetworkInstanceConfig(id string) (networkInstanceConfig *config.NetworkInstanceConfig, err error)

GetNetworkInstanceConfig return NetworkInstance config from cloud by ID

func (*CloudCtx) GetPhysicalIO

func (cloud *CloudCtx) GetPhysicalIO(id string) (physicalIO *config.PhysicalIO, err error)

GetPhysicalIO return PhysicalIO config from cloud by ID

func (*CloudCtx) GetSystemAdapter

func (cloud *CloudCtx) GetSystemAdapter(id string) (systemAdapter *config.SystemAdapter, err error)

GetSystemAdapter return SystemAdapter config from cloud by ID

func (*CloudCtx) GetVars

func (cloud *CloudCtx) GetVars() *utils.ConfigVars

GetVars returns variables of controller

func (*CloudCtx) GetVolume

func (cloud *CloudCtx) GetVolume(id string) (volume *config.Volume, err error)

GetVolume return Volume config from cloud by ID

func (*CloudCtx) ListApplicationInstanceConfig

func (cloud *CloudCtx) ListApplicationInstanceConfig() []*config.AppInstanceConfig

ListApplicationInstanceConfig return ApplicationInstance configs from cloud

func (*CloudCtx) ListBaseOSConfig

func (cloud *CloudCtx) ListBaseOSConfig() []*config.BaseOSConfig

ListBaseOSConfig return baseOS configs from cloud

func (*CloudCtx) ListContentTree

func (cloud *CloudCtx) ListContentTree() []*config.ContentTree

ListContentTree return ContentTree configs from cloud

func (*CloudCtx) ListDataStore

func (cloud *CloudCtx) ListDataStore() []*config.DatastoreConfig

ListDataStore return DataStore configs from cloud

func (*CloudCtx) ListImage

func (cloud *CloudCtx) ListImage() []*config.Image

ListImage return Image configs from cloud

func (*CloudCtx) ListNetworkInstanceConfig

func (cloud *CloudCtx) ListNetworkInstanceConfig() []*config.NetworkInstanceConfig

ListNetworkInstanceConfig return NetworkInstance configs from cloud

func (*CloudCtx) ListVolume

func (cloud *CloudCtx) ListVolume() []*config.Volume

ListVolume return Volume configs from cloud

func (*CloudCtx) OnBoardDev

func (cloud *CloudCtx) OnBoardDev(node *device.Ctx) error

OnBoardDev in controller

func (*CloudCtx) RemoveApplicationInstanceConfig

func (cloud *CloudCtx) RemoveApplicationInstanceConfig(id string) error

RemoveApplicationInstanceConfig remove AppInstanceConfig config to cloud

func (*CloudCtx) RemoveBaseOsConfig

func (cloud *CloudCtx) RemoveBaseOsConfig(id string) error

RemoveBaseOsConfig remove BaseOsConfig from cloud

func (*CloudCtx) RemoveContentTree

func (cloud *CloudCtx) RemoveContentTree(id string) error

RemoveContentTree remove ContentTree config to cloud

func (*CloudCtx) RemoveDataStore

func (cloud *CloudCtx) RemoveDataStore(id string) error

RemoveDataStore remove DataStore config from cloud

func (*CloudCtx) RemoveImage

func (cloud *CloudCtx) RemoveImage(id string) error

RemoveImage remove Image config from cloud

func (*CloudCtx) RemoveNetworkConfig

func (cloud *CloudCtx) RemoveNetworkConfig(id string) error

RemoveNetworkConfig remove NetworkConfig config to cloud

func (*CloudCtx) RemoveNetworkInstanceConfig

func (cloud *CloudCtx) RemoveNetworkInstanceConfig(id string) error

RemoveNetworkInstanceConfig remove NetworkInstance config to cloud

func (*CloudCtx) RemovePhysicalIO

func (cloud *CloudCtx) RemovePhysicalIO(id string) error

RemovePhysicalIO remove PhysicalIO config to cloud

func (*CloudCtx) RemoveSystemAdapter

func (cloud *CloudCtx) RemoveSystemAdapter(id string) error

RemoveSystemAdapter remove SystemAdapter config to cloud

func (*CloudCtx) RemoveVolume

func (cloud *CloudCtx) RemoveVolume(id string) error

RemoveVolume remove Volume config to cloud

func (*CloudCtx) SetVars

func (cloud *CloudCtx) SetVars(vars *utils.ConfigVars)

SetVars sets variables of controller

func (*CloudCtx) StateUpdate

func (cloud *CloudCtx) StateUpdate(dev *device.Ctx) (err error)

StateUpdate refresh state file

type Controller

type Controller interface {
	ConfigGet(devUUID uuid.UUID) (out string, err error)
	ConfigSet(devUUID uuid.UUID, devConfig []byte) (err error)
	LogAppsChecker(devUUID uuid.UUID, appUUID uuid.UUID, q map[string]string, handler eapps.HandlerFunc, mode eapps.LogCheckerMode, timeout time.Duration) (err error)
	LogAppsLastCallback(devUUID uuid.UUID, appUUID uuid.UUID, q map[string]string, handler eapps.HandlerFunc) (err error)
	LogChecker(devUUID uuid.UUID, q map[string]string, handler elog.HandlerFunc, mode elog.LogCheckerMode, timeout time.Duration) (err error)
	LogLastCallback(devUUID uuid.UUID, q map[string]string, handler elog.HandlerFunc) (err error)
	InfoChecker(devUUID uuid.UUID, q map[string]string, handler einfo.HandlerFunc, mode einfo.InfoCheckerMode, timeout time.Duration) (err error)
	InfoLastCallback(devUUID uuid.UUID, q map[string]string, handler einfo.HandlerFunc) (err error)
	MetricChecker(devUUID uuid.UUID, q map[string]string, handler emetric.HandlerFunc, mode emetric.MetricCheckerMode, timeout time.Duration) (err error)
	MetricLastCallback(devUUID uuid.UUID, q map[string]string, handler emetric.HandlerFunc) (err error)
	RequestLastCallback(devUUID uuid.UUID, q map[string]string, handler erequest.HandlerFunc) (err error)
	DeviceList(types.DeviceStateFilter) (out []string, err error)
	DeviceGetByOnboard(eveCert string) (devUUID uuid.UUID, err error)
	DeviceGetByOnboardUUID(onboardUUID string) (devUUID uuid.UUID, err error)
	DeviceGetOnboard(devUUID uuid.UUID) (onboardUUID uuid.UUID, err error)
	GetDeviceCert(device *device.Ctx) (*server.DeviceCert, error)
	UploadDeviceCert(server.DeviceCert) error
	OnboardRemove(onboardUUID string) (err error)
	DeviceRemove(devUUID uuid.UUID) (err error)
	Register(device *device.Ctx) error
	GetDir() (dir string)
	InitWithVars(vars *utils.ConfigVars) error
}

Controller is an interface of controller

type DevModel

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

DevModel is dev model fields

func (*DevModel) GetFirstAdapterForSwitches

func (ctx *DevModel) GetFirstAdapterForSwitches() string

GetFirstAdapterForSwitches return first adapter available for switch networkInstance

func (*DevModel) GetNetDHCPID

func (ctx *DevModel) GetNetDHCPID() string

GetNetDHCPID return netDHCPID id

func (*DevModel) GetNetNoDHCPID

func (ctx *DevModel) GetNetNoDHCPID() string

GetNetNoDHCPID return netNoDHCPID id

func (*DevModel) SetWiFiParams

func (ctx *DevModel) SetWiFiParams(ssid string, psk string)

SetWiFiParams set ssid and psk for RPI

type DevModelType

type DevModelType string

DevModelType is type of dev model

const DevModelTypeEmpty DevModelType = "Empty"

DevModelTypeEmpty is empty model type

const DevModelTypeGCP DevModelType = defaults.DefaultGCPModel

DevModelTypeGCP is model type for GCP

const DevModelTypeQemu DevModelType = defaults.DefaultEVEModel

DevModelTypeQemu is model type for qemu

const DevModelTypeRaspberry DevModelType = defaults.DefaultRPIModel

DevModelTypeRaspberry is model type for Raspberry

Directories

Path Synopsis
Package eapps provides primitives for searching and processing data in Log files of apps.
Package eapps provides primitives for searching and processing data in Log files of apps.
Package einfo provides primitives for searching and processing data in Info files.
Package einfo provides primitives for searching and processing data in Info files.
Package elog provides primitives for searching and processing data in Log files.
Package elog provides primitives for searching and processing data in Log files.
Package emetric provides primitives for searching and processing data in Metric files.
Package emetric provides primitives for searching and processing data in Metric files.
Package erequest provides primitives for searching and processing data in Request files.
Package erequest provides primitives for searching and processing data in Request files.

Jump to

Keyboard shortcuts

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