Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyLabelToNode(apiserver, key, val string) error
- func CallServicebus() (response string, err error)
- func ChangeTwinValue(updateMessage DeviceTwinUpdate, deviceID string) error
- func CheckDeviceExists(deviceList []v1beta1.Device, expectedDevice *v1beta1.Device) error
- func CheckDeviceModelExists(deviceModels []v1beta1.DeviceModel, expectedDeviceModel *v1beta1.DeviceModel) error
- func CheckNodeDeleteStatus(nodehandler, nodename string) int
- func CheckNodeReadyStatus(nodehandler, nodename string) string
- func CheckPodDeleteState(c clientset.Interface, podList *v1.PodList)
- func CheckRuleExists(rules []rulesv1.Rule, expectedRule *rulesv1.Rule) error
- func CompareTwin(deviceTwin map[string]*MsgTwin, expectedDeviceTwin map[string]*MsgTwin) bool
- func CopyFlags(source *flag.FlagSet, target *flag.FlagSet)
- func CreateDeployment(c clientset.Interface, deployment *apps.Deployment) (*apps.Deployment, error)
- func CreatePod(c clientset.Interface, pod *v1.Pod) (*v1.Pod, error)
- func CreateStatefulSet(c clientset.Interface, statefulSet *apps.StatefulSet) (*apps.StatefulSet, error)
- func DeRegisterNodeFromMaster(nodehandler, nodename string) error
- func DeleteConfigMap(client clientset.Interface, ns, name string) error
- func DeleteDeployment(c clientset.Interface, ns, name string) error
- func DeletePod(c clientset.Interface, ns, name string) error
- func DeleteStatefulSet(c clientset.Interface, ns, name string) error
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func GenerateNodeReqBody(nodeid, nodeselector string) (map[string]interface{}, error)
- func GetDeployment(c clientset.Interface, ns, name string) (*apps.Deployment, error)
- func GetNodes(api string) v1.NodeList
- func GetPod(c clientset.Interface, ns, name string) (*v1.Pod, error)
- func GetPods(c clientset.Interface, ns string, labelSelector labels.Selector, ...) (*v1.PodList, error)
- func GetRandomString(length int) string
- func GetStatefulSet(c clientset.Interface, ns, name string) (*apps.StatefulSet, error)
- func GetTwin(updateMessage DeviceTwinUpdate, deviceID string) error
- func HandleConfigmap(configName chan error, operation, confighandler string, IsEdgeCore bool)
- func HandleDeviceInstance(c edgeclientset.Interface, operation string, nodeName string, UID string, ...) error
- func HandleDeviceModel(c edgeclientset.Interface, operation string, UID string, protocolType string) error
- func HandleRule(c edgeclientset.Interface, operation, UID string, ...) error
- func HandleRuleEndpoint(c edgeclientset.Interface, operation string, UID string, ...) error
- func IncorrectDeviceInstance() v1beta1.Device
- func IncorrectDeviceModel() v1beta1.DeviceModel
- func Infof(format string, args ...interface{})
- func ListDevice(c edgeclientset.Interface, ns string) ([]v1beta1.Device, error)
- func ListDeviceModel(c edgeclientset.Interface, ns string) ([]v1beta1.DeviceModel, error)
- func ListRule(c edgeclientset.Interface, ns string) ([]rulesv1.Rule, error)
- func ListRuleEndpoint(c edgeclientset.Interface, ns string) ([]rulesv1.RuleEndpoint, error)
- func MqttClientInit(server, clientID, username, password string) *MQTT.ClientOptions
- func MqttConnect() error
- func NewDeployment(name, imgURL string, replicas int32) *apps.Deployment
- func NewEventbus2RestRule() *rulesv1.Rule
- func NewKubeClient(kubeConfigPath string) clientset.Interface
- func NewKubeEdgeClient(kubeConfigPath string) edgeclientset.Interface
- func NewModbusDeviceInstance(nodeName string) v1beta1.Device
- func NewModbusDeviceModel() v1beta1.DeviceModel
- func NewPod(podName, imgURL string) *v1.Pod
- func NewRest2EventbusRule() *rulesv1.Rule
- func NewRest2ServicebusRule() *rulesv1.Rule
- func NewRule(sourceType, targetType rulesv1.RuleEndpointTypeDef) *rulesv1.Rule
- func NewRuleEndpoint(endpointType rulesv1.RuleEndpointTypeDef) *rulesv1.RuleEndpoint
- func NewServicebus2Rest() *rulesv1.Rule
- func NewTestStatefulSet(name, imgURL string, replicas int32) *apps.StatefulSet
- func OnTwinMessageReceived(_ MQTT.Client, message MQTT.Message)
- func PrintTestcaseNameandStatus()
- func PublishMqtt(topic, message string) error
- func RegisterFlags(flags *flag.FlagSet)
- func RegisterNodeToMaster(UID, nodehandler, nodeselector string) error
- func SendHTTPRequest(method, reqAPI string) (*http.Response, error)
- func SendMsg(url string, message []byte, header map[string]string) (bool, int)
- func StartEchoServer() (string, error)
- func SubscribeMqtt(topic string) (string, error)
- func TaintEdgeDeployedNode(toTaint bool, taintHandler string) error
- func TwinSubscribe(deviceID string)
- func UpdatedModbusDeviceInstance(nodeName string) v1beta1.Device
- func UpdatedModbusDeviceModel() v1beta1.DeviceModel
- func WaitForPodsRunning(c clientset.Interface, podList *v1.PodList, timeout time.Duration)
- func WaitForPodsToDisappear(c clientset.Interface, ns string, label labels.Selector, ...) error
- func WaitForStatusReplicas(c clientset.Interface, ss *apps.StatefulSet, expectedReplicas int32)
- type BaseMessage
- type Config
- type DeviceTwinResult
- type DeviceTwinUpdate
- type MsgTwin
- type ServicebusResponse
- 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" ModBus = "modbus" IncorrectInstance = "incorrect-instance" IncorrectModel = "incorrect-model" )
Variables ¶
var CRDTestTimerGroup = NewTestTimerGroup()
var Client MQTT.Client
var ClientOpts *MQTT.ClientOptions
var Flags = flag.NewFlagSet("", flag.ContinueOnError)
Functions ¶
func ApplyLabelToNode ¶ added in v0.3.0
func CallServicebus ¶ added in v1.9.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 CheckDeviceExists ¶ added in v1.13.0
func CheckDeviceModelExists ¶ added in v1.13.0
func CheckDeviceModelExists(deviceModels []v1beta1.DeviceModel, expectedDeviceModel *v1beta1.DeviceModel) error
CheckDeviceModelExists verify whether the contents of the device model matches with what is expected
func CheckNodeDeleteStatus ¶
CheckNodeDeleteStatus function to check node delete status
func CheckNodeReadyStatus ¶
CheckNodeReadyStatus function to get node status
func CheckPodDeleteState ¶
CheckPodDeleteState check whether the given pod list is deleted successfully
func CheckRuleExists ¶ added in v1.13.0
func CompareTwin ¶ added in v1.0.0
CompareTwin is used to compare 2 device Twins
func CreateDeployment ¶ added in v1.13.0
func CreateDeployment(c clientset.Interface, deployment *apps.Deployment) (*apps.Deployment, error)
func CreateStatefulSet ¶ added in v1.12.0
func CreateStatefulSet(c clientset.Interface, statefulSet *apps.StatefulSet) (*apps.StatefulSet, error)
func DeRegisterNodeFromMaster ¶
DeRegisterNodeFromMaster function to deregister the node from master
func DeleteConfigMap ¶ added in v1.13.0
func DeleteDeployment ¶
DeleteDeployment to delete deployment
func DeleteStatefulSet ¶ added in v1.12.0
DeleteStatefulSet to delete statefulSet
func Fatalf ¶ added in v1.1.0
func Fatalf(format string, args ...interface{})
Fatalf log Failure logs
func GenerateNodeReqBody ¶
GenerateNodeReqBody function to generate the node request body
func GetDeployment ¶ added in v1.13.0
func GetStatefulSet ¶ added in v1.12.0
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 HandleDeviceInstance ¶ added in v1.0.0
func HandleDeviceInstance(c edgeclientset.Interface, operation string, nodeName string, UID string, protocolType string) error
HandleDeviceInstance to handle app deployment/delete using pod spec.
func HandleDeviceModel ¶ added in v1.0.0
func HandleDeviceModel(c edgeclientset.Interface, operation string, UID string, protocolType string) error
HandleDeviceModel to handle DeviceModel operation to apiserver.
func HandleRule ¶ added in v1.6.0
func HandleRule(c edgeclientset.Interface, operation, UID string, sourceType, targetType rulesv1.RuleEndpointTypeDef) error
HandleRule to handle rule.
func HandleRuleEndpoint ¶ added in v1.6.0
func HandleRuleEndpoint(c edgeclientset.Interface, operation string, UID string, endpointType rulesv1.RuleEndpointTypeDef) error
HandleRuleEndpoint to handle ruleendpoint.
func IncorrectDeviceInstance ¶ added in v1.0.0
func IncorrectDeviceModel ¶ added in v1.0.0
func IncorrectDeviceModel() v1beta1.DeviceModel
func ListDevice ¶ added in v1.13.0
func ListDeviceModel ¶ added in v1.13.0
func ListDeviceModel(c edgeclientset.Interface, ns string) ([]v1beta1.DeviceModel, error)
func ListRuleEndpoint ¶ added in v1.13.0
func ListRuleEndpoint(c edgeclientset.Interface, ns string) ([]rulesv1.RuleEndpoint, error)
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 NewDeployment ¶ added in v1.13.0
func NewDeployment(name, imgURL string, replicas int32) *apps.Deployment
func NewEventbus2RestRule ¶ added in v1.6.0
func NewKubeClient ¶ added in v0.3.0
NewKubeClient creates kube client from config
func NewKubeEdgeClient ¶ added in v1.13.0
func NewKubeEdgeClient(kubeConfigPath string) edgeclientset.Interface
NewKubeEdgeClient creates kubeEdge CRD client from config
func NewModbusDeviceInstance ¶ added in v1.0.0
func NewModbusDeviceModel ¶ added in v1.0.0
func NewModbusDeviceModel() v1beta1.DeviceModel
func NewRest2EventbusRule ¶ added in v1.6.0
func NewRest2ServicebusRule ¶ added in v1.7.0
func NewRule ¶ added in v1.6.0
func NewRule(sourceType, targetType rulesv1.RuleEndpointTypeDef) *rulesv1.Rule
func NewRuleEndpoint ¶ added in v1.6.0
func NewRuleEndpoint(endpointType rulesv1.RuleEndpointTypeDef) *rulesv1.RuleEndpoint
func NewServicebus2Rest ¶ added in v1.9.0
func NewTestStatefulSet ¶ added in v1.12.0
func NewTestStatefulSet(name, imgURL string, replicas int32) *apps.StatefulSet
NewTestStatefulSet create statefulSet for test
func OnTwinMessageReceived ¶ added in v1.0.0
OnTwinMessageReceived callback function which is called when message is received
func PrintTestcaseNameandStatus ¶
func PrintTestcaseNameandStatus()
PrintTestcaseNameandStatus print the test case name and status of execution
func PublishMqtt ¶ added in v1.6.0
func RegisterFlags ¶ added in v1.11.0
func RegisterNodeToMaster ¶
RegisterNodeToMaster function to register node to master
func SendHTTPRequest ¶ added in v1.4.0
SendHTTPRequest Function to prepare the http req and send
func StartEchoServer ¶ added in v1.6.0
func SubscribeMqtt ¶ added in v1.6.0
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 UpdatedModbusDeviceInstance ¶ added in v1.0.0
func UpdatedModbusDeviceModel ¶ added in v1.0.0
func UpdatedModbusDeviceModel() v1beta1.DeviceModel
func WaitForPodsRunning ¶ added in v1.13.0
WaitForPodsRunning waits util all pods are in running status or timeout
func WaitForPodsToDisappear ¶ added in v1.12.0
func WaitForStatusReplicas ¶ added in v1.12.0
func WaitForStatusReplicas(c clientset.Interface, ss *apps.StatefulSet, expectedReplicas int32)
WaitForStatusReplicas waits for the ss.Status.Replicas to be equal to expectedReplicas
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"` NumOfNodes int `json:"node_num"` K8SMasterForProvisionEdgeNodes string `json:"k8smasterforprovisionedgenodes"` CloudImageURL string `json:"cloudimageurl"` EdgeImageURL string `json:"edgeimageurl"` ControllerStubPort int `json:"controllerstubport"` Protocol string `json:"protocol"` TestDevice bool }
Config 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 ServicebusResponse ¶ added in v1.9.0
type TestContext ¶
type TestContext struct {
Cfg Config
}
TestContext 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