Documentation ¶
Overview ¶
Copyright 2019 The KubeEdge Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The KubeEdge Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The KubeEdge Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func ApplyLabelToNode(apiserver, key, val string) error
- func ChangeTwinValue(updateMessage DeviceTwinUpdate, deviceID string) error
- func CheckDeploymentPodDeleteState(apiserver string, podlist v1.PodList)
- func CheckNodeDeleteStatus(nodehandler, nodename string) int
- func CheckNodeReadyStatus(nodehandler, nodename string) string
- func CheckPodDeleteState(apiserver string, podlist v1.PodList)
- func CheckPodRunningState(apiserver string, podlist v1.PodList)
- func CleanUp(setupType string) error
- func CompareConfigMaps(configMap, expectedConfigMap v1.ConfigMap) bool
- func CompareTwin(deviceTwin map[string]*MsgTwin, expectedDeviceTwin map[string]*MsgTwin) bool
- func CreateServiceObject(name string) *v1.Service
- func DeRegisterNodeFromMaster(nodehandler, nodename string) error
- func Debug(format string, data []byte, err error)
- func DeleteConfigmap(apiConfigMap string) int
- func DeleteDeployment(DeploymentApi, deploymentname string) int
- func DeletePods(apiserver string) (string, int)
- func DeleteSvc(svcname string) int
- func DeploySetup(ctx *TestContext, nodeName, setupType string) error
- func Err(format string, args ...interface{})
- func ExposeCloudService(name, serviceHandler string) error
- func Failf(format string, args ...interface{})
- func GenerateCerts() error
- func GenerateNodeReqBody(nodeid, nodeselector string) (error, map[string]interface{})
- func GetConfigmap(apiConfigMap string) (int, []byte)
- func GetDeployments(list *apps.DeploymentList, getDeploymentApi string) error
- func GetDevice(list *v1alpha1.DeviceList, getDeviceApi string, ...) ([]v1alpha1.Device, error)
- func GetDeviceModel(list *v1alpha1.DeviceModelList, getDeviceModelApi string, ...) ([]v1alpha1.DeviceModel, error)
- func GetNodes(api string) v1.NodeList
- func GetPodState(apiserver string) (string, int)
- func GetPods(apiserver, label string) (v1.PodList, error)
- func GetRandomString(length int) string
- func GetServicePort(cloudName, serviceHandler string) (int32, int32)
- func GetTwin(updateMessage DeviceTwinUpdate, deviceID string) error
- func HandleConfigmap(configName chan error, operation, confighandler string, IsEdgeCore bool)
- func HandleDeployment(IsCloudCore, IsEdgeCore bool, ...) bool
- func HandleDeviceInstance(operation string, apiserver string, nodeSelector string, UID string, ...) (bool, int)
- func HandleDeviceModel(operation string, apiserver string, UID string, protocolType string) (bool, int)
- func HandlePod(operation string, apiserver string, UID string, ImageUrl, nodeselector string) bool
- func IncorrectDeviceInstance() v1alpha1.Device
- func IncorrectDeviceModel() v1alpha1.DeviceModel
- func Info(format string, args ...interface{})
- func InfoV2(format string, args ...interface{})
- func InfoV6(format string, args ...interface{})
- func Logf(format string, args ...interface{})
- func MapLabels(ls map[string]string) string
- func MqttClientInit(server, clientID, username, password string) *MQTT.ClientOptions
- func MqttConnect() error
- func NewBluetoothDeviceInstance(nodeSelector string) v1alpha1.Device
- func NewBluetoothDeviceModel() v1alpha1.DeviceModel
- func NewConfigMapBluetooth(nodeSelector string) v12.ConfigMap
- func NewConfigMapLED(nodeSelector string) v12.ConfigMap
- func NewConfigMapModbus(nodeSelector string) v12.ConfigMap
- func NewKubeClient(apiserver string) *kubernetes.Clientset
- func NewLedDeviceInstance(nodeSelector string) v1alpha1.Device
- func NewLedDeviceModel() v1alpha1.DeviceModel
- func NewModbusDeviceInstance(nodeSelector string) v1alpha1.Device
- func NewModbusDeviceModel() v1alpha1.DeviceModel
- func OnTwinMessageReceived(client MQTT.Client, message MQTT.Message)
- func PrintCombinedOutput(cmd *exec.Cmd) error
- func PrintTestcaseNameandStatus()
- func RandomInt(min, max int) int
- func RegisterNodeToMaster(UID, nodehandler, nodeselector string) error
- func SendHttpRequest(method, reqApi string) (error, *http.Response)
- func StartEdgeController() error
- func StartEdgeCore() error
- func StartEdgeSite() error
- func TaintEdgeDeployedNode(toTaint bool, taintHandler string) error
- func TwinSubscribe(deviceID string)
- func UpdatedBluetoothDeviceInstance(nodeSelector string) v1alpha1.Device
- func UpdatedBluetoothDeviceModel() v1alpha1.DeviceModel
- func UpdatedLedDeviceInstance(nodeSelector string) v1alpha1.Device
- func UpdatedLedDeviceModel() v1alpha1.DeviceModel
- func UpdatedModbusDeviceInstance(nodeSelector string) v1alpha1.Device
- func UpdatedModbusDeviceModel() v1alpha1.DeviceModel
- func VerifyDeleteDeployment(getDeploymentApi string) int
- func WaitforPodsRunning(apiserver string, podlist v1.PodList, timout time.Duration)
- type BaseMessage
- type Config
- type DeviceTwinResult
- type DeviceTwinUpdate
- type MsgTwin
- type TestContext
- type TestTimer
- type TestTimerGroup
- type Token
- type TwinValue
- type TwinVersion
- type TypeMetadata
- type ValueMetadata
Constants ¶
const ( Namespace = "default" DeviceETPrefix = "$hw/events/device/" TwinETUpdateSuffix = "/twin/update" TwinETGetSuffix = "/twin/get" TwinETGetResultSuffix = "/twin/get/result" )
Variables ¶
var ( ProtocolQuic bool ProtocolWebsocket bool )
var Client MQTT.Client
var ClientOpts *MQTT.ClientOptions
Functions ¶
func ApplyLabelToNode ¶ added in v0.3.0
func ChangeTwinValue ¶ added in v1.0.0
func ChangeTwinValue(updateMessage DeviceTwinUpdate, deviceID string) error
ChangeTwinValue sends the updated twin value to the edge through the MQTT broker
func CheckDeploymentPodDeleteState ¶ added in v0.3.0
CheckPodDeleteState function to check the Pod state
func CheckNodeDeleteStatus ¶
CheckNodeDeleteStatus function to check node delete status
func CheckNodeReadyStatus ¶
CheckNodeReadyStatus function to get node status
func CheckPodDeleteState ¶
CheckPodDeleteState function to check the Pod state
func CheckPodRunningState ¶
CheckPodRunningState function to check the Pod state
func CompareConfigMaps ¶ added in v1.0.0
CompareConfigMaps is used to compare 2 config maps
func CompareTwin ¶ added in v1.0.0
CompareTwin is used to compare 2 device Twins
func CreateServiceObject ¶ added in v0.3.0
CreateServiceObject function to create a servcice object
func DeRegisterNodeFromMaster ¶
DeRegisterNodeFromMaster function to deregister the node from master
func DeleteConfigmap ¶ added in v1.0.0
DeleteConfigmap function to delete configmaps
func DeleteDeployment ¶
DeleteDeployment to delete deployment
func DeletePods ¶
DeletePods function to get the pod status and response code
func DeploySetup ¶ added in v1.0.0
func DeploySetup(ctx *TestContext, nodeName, setupType string) error
func ExposeCloudService ¶ added in v0.3.0
ExposeCloudService function to expose the service for cloud deployment
func GenerateCerts ¶ added in v1.0.0
func GenerateCerts() error
GenerateCerts - Generates Cerificates for Edge and Cloud nodes copy to respective folders
func GenerateNodeReqBody ¶
GenerateNodeReqBody function to generate the node request body
func GetConfigmap ¶ added in v0.3.0
GetConfigmap function to get configmaps for respective edgenodes
func GetDeployments ¶
func GetDeployments(list *apps.DeploymentList, getDeploymentApi string) error
GetDeployments to get the deployments list
func GetDevice ¶ added in v1.0.0
func GetDevice(list *v1alpha1.DeviceList, getDeviceApi string, expectedDevice *v1alpha1.Device) ([]v1alpha1.Device, error)
GetDevice to get the device list
func GetDeviceModel ¶ added in v1.0.0
func GetDeviceModel(list *v1alpha1.DeviceModelList, getDeviceModelApi string, expectedDeviceModel *v1alpha1.DeviceModel) ([]v1alpha1.DeviceModel, error)
GetDeviceModel to get the deviceModel list and verify whether the contents of the device model matches with what is expected
func GetPodState ¶
GetPodState function to get the pod status and response code
func GetServicePort ¶ added in v0.3.0
GetServicePort function to get the service port created for deployment.
func GetTwin ¶ added in v1.0.0
func GetTwin(updateMessage DeviceTwinUpdate, deviceID string) error
GetTwin function is used to get the device twin details from the edge
func HandleConfigmap ¶ added in v0.3.0
HandleConfigmap function to create configmaps for respective edgenodes
func HandleDeployment ¶
func HandleDeployment(IsCloudCore, IsEdgeCore bool, operation, apiserver, UID, ImageUrl, nodeselector, configmapname string, replica int) bool
HandleDeployment to handle app deployment/delete deployment.
func HandleDeviceInstance ¶ added in v1.0.0
func HandleDeviceInstance(operation string, apiserver string, nodeSelector string, UID string, protocolType string) (bool, int)
HandleDeviceInstance to handle app deployment/delete using pod spec.
func HandleDeviceModel ¶ added in v1.0.0
func HandleDeviceModel(operation string, apiserver string, UID string, protocolType string) (bool, int)
HandleDeviceModel to handle app deployment/delete using pod spec.
func IncorrectDeviceInstance ¶ added in v1.0.0
func IncorrectDeviceModel ¶ added in v1.0.0
func IncorrectDeviceModel() v1alpha1.DeviceModel
func MqttClientInit ¶ added in v1.0.0
func MqttClientInit(server, clientID, username, password string) *MQTT.ClientOptions
MqttClientInit create mqtt client config
func MqttConnect ¶ added in v1.0.0
func MqttConnect() error
MqttConnect function felicitates the MQTT connection
func NewBluetoothDeviceInstance ¶ added in v1.0.0
func NewBluetoothDeviceModel ¶ added in v1.0.0
func NewBluetoothDeviceModel() v1alpha1.DeviceModel
func NewConfigMapBluetooth ¶ added in v1.0.0
func NewConfigMapLED ¶ added in v1.0.0
func NewConfigMapModbus ¶ added in v1.0.0
func NewKubeClient ¶ added in v0.3.0
func NewKubeClient(apiserver string) *kubernetes.Clientset
NewKubeClient creates kube client from config
func NewLedDeviceInstance ¶ added in v1.0.0
func NewLedDeviceModel ¶ added in v1.0.0
func NewLedDeviceModel() v1alpha1.DeviceModel
func NewModbusDeviceInstance ¶ added in v1.0.0
func NewModbusDeviceModel ¶ added in v1.0.0
func NewModbusDeviceModel() v1alpha1.DeviceModel
func OnTwinMessageReceived ¶ added in v1.0.0
OnTwinMessageReceived callback function which is called when message is received
func PrintCombinedOutput ¶
PrintCombinedOutput to show the os command injuction in combined format
func PrintTestcaseNameandStatus ¶
func PrintTestcaseNameandStatus()
Function to print the test case name and status of execution
func RegisterNodeToMaster ¶
RegisterNodeToMaster function to register node to master
func SendHttpRequest ¶
SendHttpRequest Function to prepare the http req and send
func StartEdgeController ¶ added in v1.0.0
func StartEdgeController() error
func StartEdgeCore ¶ added in v1.0.0
func StartEdgeCore() error
func StartEdgeSite ¶ added in v1.0.0
func StartEdgeSite() error
func TaintEdgeDeployedNode ¶ added in v0.3.0
func TwinSubscribe ¶ added in v1.0.0
func TwinSubscribe(deviceID string)
subscribe function subscribes the device twin information through the MQTT broker
func UpdatedBluetoothDeviceInstance ¶ added in v1.0.0
func UpdatedBluetoothDeviceModel ¶ added in v1.0.0
func UpdatedBluetoothDeviceModel() v1alpha1.DeviceModel
func UpdatedLedDeviceInstance ¶ added in v1.0.0
func UpdatedLedDeviceModel ¶ added in v1.0.0
func UpdatedLedDeviceModel() v1alpha1.DeviceModel
func UpdatedModbusDeviceInstance ¶ added in v1.0.0
func UpdatedModbusDeviceModel ¶ added in v1.0.0
func UpdatedModbusDeviceModel() v1alpha1.DeviceModel
func VerifyDeleteDeployment ¶ added in v0.3.0
Types ¶
type BaseMessage ¶ added in v1.0.0
BaseMessage the base struct of event message
type Config ¶
type Config struct { AppImageUrl []string `json:"image_url"` K8SMasterForKubeEdge string `json:"k8smasterforkubeedge"` Nodes map[string]vmSpec `json:"k8snodes"` NumOfNodes int `json:"node_num"` ImageRepo string `json:"imagerepo"` K8SMasterForProvisionEdgeNodes string `json:"k8smasterforprovisionedgenodes"` CloudImageUrl string `json:"cloudimageurl"` EdgeImageUrl string `json:"edgeimageurl"` Namespace string `json:"namespace"` ControllerStubPort int `json:"controllerstubport"` Protocol string `json:"protocol"` }
config.json decode struct
type DeviceTwinResult ¶ added in v1.0.0
type DeviceTwinResult struct { BaseMessage Twin map[string]*MsgTwin `json:"twin"` }
DeviceTwinResult device get result
var TwinResult DeviceTwinResult
type DeviceTwinUpdate ¶ added in v1.0.0
type DeviceTwinUpdate struct { BaseMessage Twin map[string]*MsgTwin `json:"twin"` }
DeviceTwinUpdate the struct of device twin update
type MsgTwin ¶ added in v1.0.0
type MsgTwin struct { Expected *TwinValue `json:"expected,omitempty"` Actual *TwinValue `json:"actual,omitempty"` Optional *bool `json:"optional,omitempty"` Metadata *TypeMetadata `json:"metadata,omitempty"` ExpectedVersion *TwinVersion `json:"expected_version,omitempty"` ActualVersion *TwinVersion `json:"actual_version,omitempty"` }
MsgTwin the struct of device twin
type TestContext ¶
type TestContext struct {
Cfg Config
}
Test context struct
func NewTestContext ¶
func NewTestContext(cfg Config) *TestContext
NewTestContext function to build testcontext with provided config.
type TestTimer ¶ added in v0.3.0
TestTimer represents a test timer
func (*TestTimer) End ¶ added in v0.3.0
func (testTimer *TestTimer) End()
End is used to end the test timer
func (*TestTimer) PrintResult ¶ added in v0.3.0
func (testTimer *TestTimer) PrintResult()
PrintResult prints the result of the test timer
type TestTimerGroup ¶ added in v0.3.0
type TestTimerGroup struct {
// contains filtered or unexported fields
}
TestTimerGroup includes one or more test timers
func NewTestTimerGroup ¶ added in v0.3.0
func NewTestTimerGroup() *TestTimerGroup
NewTestTimerGroup creates a new test timer group
func (*TestTimerGroup) GetTestTimers ¶ added in v0.3.0
func (group *TestTimerGroup) GetTestTimers() []*TestTimer
GetTestTimers returns test timers
func (*TestTimerGroup) NewTestTimer ¶ added in v0.3.0
func (group *TestTimerGroup) NewTestTimer(name string) *TestTimer
NewTestTimer creates a new test timer
func (*TestTimerGroup) PrintResult ¶ added in v0.3.0
func (group *TestTimerGroup) PrintResult()
PrintResult prints the results of all test timers.
type TwinValue ¶ added in v1.0.0
type TwinValue struct { Value *string `json:"value, omitempty"` Metadata *ValueMetadata `json:"metadata,omitempty"` }
TwinValue the struct of twin value
type TwinVersion ¶ added in v1.0.0
TwinVersion twin version
type TypeMetadata ¶ added in v1.0.0
type TypeMetadata struct {
Type string `json:"type,omitempty"`
}
TypeMetadata the meta of value type
type ValueMetadata ¶ added in v1.0.0
type ValueMetadata struct {
Timestamp int64 `json:"timestamp, omitempty"`
}
ValueMetadata the meta of value