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 CompareDeviceProfileInConfigMaps(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 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 Errorf(format string, args ...interface{})
- func ExposeCloudService(name, serviceHandler string) error
- func Fatalf(format string, args ...interface{})
- func GenerateCerts() error
- func GenerateNodeReqBody(nodeid, nodeselector string) (map[string]interface{}, error)
- func GetConfigmap(apiConfigMap string) (int, []byte)
- func GetDeployments(list *apps.DeploymentList, getDeploymentAPI string) error
- func GetDevice(list *v1alpha2.DeviceList, getDeviceAPI string, ...) ([]v1alpha2.Device, error)
- func GetDeviceModel(list *v1alpha2.DeviceModelList, getDeviceModelAPI string, ...) ([]v1alpha2.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 GetRuleEndpointList(list *rulesv1.RuleEndpointList, getRuleEndpointAPI string, ...) ([]rulesv1.RuleEndpoint, error)
- func GetRuleList(list *rulesv1.RuleList, getRuleAPI string, expectedRule *rulesv1.Rule) ([]rulesv1.Rule, error)
- 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, pod *v1.Pod) bool
- func HandleRule(operation, apiserver, UID, sourceType, targetType string) (bool, int)
- func HandleRuleEndpoint(operation string, apiserver string, UID string, endpointType string) (bool, int)
- func IncorrectDeviceInstance() v1alpha2.Device
- func IncorrectDeviceModel() v1alpha2.DeviceModel
- func Infof(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) v1alpha2.Device
- func NewBluetoothDeviceModel() v1alpha2.DeviceModel
- func NewConfigMapBluetooth(nodeSelector string) v12.ConfigMap
- func NewConfigMapCustomized(nodeSelector string) v12.ConfigMap
- func NewConfigMapLED(nodeSelector string) v12.ConfigMap
- func NewConfigMapModbus(nodeSelector string) v12.ConfigMap
- func NewCustomizedDeviceInstance(nodeSelector string) v1alpha2.Device
- func NewCustomizedDeviceModel() v1alpha2.DeviceModel
- func NewEventbus2RestRule() *rulesv1.Rule
- func NewKubeClient(kubeConfigPath string) *kubernetes.Clientset
- func NewLedDeviceInstance(nodeSelector string) v1alpha2.Device
- func NewLedDeviceModel() v1alpha2.DeviceModel
- func NewMockInstance(nodeSelector string) v1alpha2.Device
- func NewModbusDeviceInstance(nodeSelector string) v1alpha2.Device
- func NewModbusDeviceModel() v1alpha2.DeviceModel
- func NewPodObj(podName, imgURL, nodeselector string) *v1.Pod
- func NewRest2EventbusRule() *rulesv1.Rule
- func NewRule(sourceType, targetType string) *rulesv1.Rule
- func NewRuleEndpoint(endpointType string) *rulesv1.RuleEndpoint
- func OnTwinMessageReceived(client MQTT.Client, message MQTT.Message)
- func PrintCombinedOutput(cmd *exec.Cmd) error
- func PrintTestcaseNameandStatus()
- func PublishMqtt(topic, message string) error
- func RandomInt(min, max int) int
- func RegisterNodeToMaster(UID, nodehandler, nodeselector string) error
- func SendHTTPRequest(method, reqAPI string) (*http.Response, error)
- func SendMsg(url string, message []byte) (bool, int)
- func StartCloudCore() error
- func StartEchoServer() (string, error)
- func StartEdgeCore(master, nodeName string) error
- func StartEdgeSite() error
- func SubscribeMqtt(topic string) (string, error)
- func TaintEdgeDeployedNode(toTaint bool, taintHandler string) error
- func TwinSubscribe(deviceID string)
- func UpdatedBluetoothDeviceInstance(nodeSelector string) v1alpha2.Device
- func UpdatedBluetoothDeviceModel() v1alpha2.DeviceModel
- func UpdatedConfigMapModbusForDataAndTwins(nodeSelector string) v12.ConfigMap
- func UpdatedLedDeviceInstance(nodeSelector string) v1alpha2.Device
- func UpdatedLedDeviceModel() v1alpha2.DeviceModel
- func UpdatedModbusDeviceInstance(nodeSelector string) v1alpha2.Device
- func UpdatedModbusDeviceModel() v1alpha2.DeviceModel
- func VerifyDeleteDeployment(getDeploymentAPI string) int
- func WaitforPodsRunning(kubeConfigPath 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" BlueTooth = "bluetooth" ModBus = "modbus" Led = "led" IncorrectInstance = "incorrect-instance" Customized = "customized" )
const ( RestType = "rest" EventbusType = "eventbus" )
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
CheckDeploymentPodDeleteState 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 CompareDeviceProfileInConfigMaps ¶ added in v1.6.1
CompareConfigMaps is used to compare 2 device profile in 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 Errorf ¶ added in v1.6.1
func Errorf(format string, args ...interface{})
function for Error log
func ExposeCloudService ¶ added in v0.3.0
ExposeCloudService function to expose the service for cloud deployment
func Fatalf ¶ added in v1.6.1
func Fatalf(format string, args ...interface{})
Funciton to log Filure logs
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 *v1alpha2.DeviceList, getDeviceAPI string, expectedDevice *v1alpha2.Device) ([]v1alpha2.Device, error)
GetDevice to get the device list
func GetDeviceModel ¶ added in v1.0.0
func GetDeviceModel(list *v1alpha2.DeviceModelList, getDeviceModelAPI string, expectedDeviceModel *v1alpha2.DeviceModel) ([]v1alpha2.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 GetRuleEndpointList ¶ added in v1.6.1
func GetRuleEndpointList(list *rulesv1.RuleEndpointList, getRuleEndpointAPI string, expectedRule *rulesv1.RuleEndpoint) ([]rulesv1.RuleEndpoint, error)
GetRuleEndpointList to get the rule endpoint list and verify whether the contents of the ruleendpoint matches with what is expected
func GetRuleList ¶ added in v1.6.1
func GetRuleList(list *rulesv1.RuleList, getRuleAPI string, expectedRule *rulesv1.Rule) ([]rulesv1.Rule, error)
GetRuleList to get the rule list and verify whether the contents of the rule matches with what is expected
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 HandleRule ¶ added in v1.6.1
HandleRule to handle rule.
func HandleRuleEndpoint ¶ added in v1.6.1
func HandleRuleEndpoint(operation string, apiserver string, UID string, endpointType string) (bool, int)
HandleRuleEndpoint to handle ruleendpoint.
func IncorrectDeviceInstance ¶ added in v1.0.0
func IncorrectDeviceModel ¶ added in v1.0.0
func IncorrectDeviceModel() v1alpha2.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() v1alpha2.DeviceModel
func NewConfigMapBluetooth ¶ added in v1.0.0
func NewConfigMapCustomized ¶ added in v1.6.1
func NewConfigMapLED ¶ added in v1.0.0
func NewConfigMapModbus ¶ added in v1.0.0
func NewCustomizedDeviceInstance ¶ added in v1.6.1
func NewCustomizedDeviceModel ¶ added in v1.6.1
func NewCustomizedDeviceModel() v1alpha2.DeviceModel
func NewEventbus2RestRule ¶ added in v1.6.1
func NewKubeClient ¶ added in v0.3.0
func NewKubeClient(kubeConfigPath 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() v1alpha2.DeviceModel
func NewMockInstance ¶ added in v1.6.1
NewMockInstance create an instance for mock bluetooth device.
func NewModbusDeviceInstance ¶ added in v1.0.0
func NewModbusDeviceModel ¶ added in v1.0.0
func NewModbusDeviceModel() v1alpha2.DeviceModel
func NewRest2EventbusRule ¶ added in v1.6.1
func NewRuleEndpoint ¶ added in v1.6.1
func NewRuleEndpoint(endpointType string) *rulesv1.RuleEndpoint
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 PublishMqtt ¶ added in v1.6.1
func RegisterNodeToMaster ¶
RegisterNodeToMaster function to register node to master
func SendHTTPRequest ¶ added in v1.6.1
SendHTTPRequest Function to prepare the http req and send
func StartCloudCore ¶ added in v1.6.1
func StartCloudCore() error
func StartEchoServer ¶ added in v1.6.1
func StartEdgeCore ¶ added in v1.0.0
func StartEdgeSite ¶ added in v1.0.0
func StartEdgeSite() error
func SubscribeMqtt ¶ added in v1.6.1
subscribe function subscribes the device twin information through the MQTT broker
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() v1alpha2.DeviceModel
func UpdatedConfigMapModbusForDataAndTwins ¶ added in v1.6.1
func UpdatedLedDeviceInstance ¶ added in v1.0.0
func UpdatedLedDeviceModel ¶ added in v1.0.0
func UpdatedLedDeviceModel() v1alpha2.DeviceModel
func UpdatedModbusDeviceInstance ¶ added in v1.0.0
func UpdatedModbusDeviceModel ¶ added in v1.0.0
func UpdatedModbusDeviceModel() v1alpha2.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"` DockerHubUserName string `json:"dockerhubusername"` DockerHubPassword string `json:"dockerhubpassword"` MqttEndpoint string `json:"mqttendpoint"` KubeConfigPath string `json:"kubeconfigpath"` Token string `json:"token"` }
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