Documentation
¶
Index ¶
- Constants
- Variables
- func AddDeviceSwitchResources(ctx context.Context, t *testing.T, deviceID string, c pb.GrpcGatewayClient, ...) []schema.ResourceLink
- func AssertToCheckFunc(...) func(t *testing.T, expected interface{}, actual interface{}, ...)
- func CheckProtobufs(t *testing.T, expected interface{}, actual interface{}, ...)
- func CheckResource(ctx context.Context, t *testing.T, deviceID, resourceURI, resourceType string, ...) bool
- func CleanUpResourcesArray(resources []*commands.Resource) []*commands.Resource
- func DecodeCbor(t *testing.T, data []byte) interface{}
- func DefaultSwitchResourceLink(deviceID, id string) schema.ResourceLink
- func EncodeToCbor(t *testing.T, v interface{}) []byte
- func FieldJsonTag(v interface{}, fieldName string) string
- func FilterResourceLink(filter func(schema.ResourceLink) bool, links []schema.ResourceLink) []schema.ResourceLink
- func FindDeviceByName(ctx context.Context, name string) (deviceID string, _ error)
- func GetAllBackendResourceLinks() []schema.ResourceLink
- func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate
- func GetRootCertificatePool(t *testing.T) *x509.CertPool
- func IsDiscoveryResourceBatchObservable(ctx context.Context, t *testing.T, deviceID string) bool
- func MakeSwitchResourceData(overrides map[string]interface{}) map[string]interface{}
- func MakeSwitchResourceDefaultData() map[string]interface{}
- func MustFindDeviceByName(name string) (deviceID string)
- func MustGetHostname() string
- func NATSSStart(ctx context.Context, t *testing.T)
- func NATSSStop(ctx context.Context, t *testing.T)
- func NewSDKClient(opts ...Option) (*client.Client, error)
- func OffBoardDevSim(ctx context.Context, t *testing.T, deviceID string)
- func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, ...) (string, func())
- func OnboardDevSimForClient(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, ...) (string, func())
- func ProtobufToInterface(t *testing.T, val interface{}) interface{}
- func RequireToCheckFunc(...) func(t *testing.T, expected interface{}, actual interface{}, ...)
- func ResourceIsBatchObservable(ctx context.Context, t *testing.T, deviceID, resourceURI, resourceType string) bool
- func ResourceLinksToResourceIds(deviceID string, s []schema.ResourceLink) []*commands.ResourceId
- func ResourceLinksToResources(deviceID string, s []schema.ResourceLink) []*commands.Resource
- func ResourceLinksToResources2(deviceID string, s []schema.ResourceLink) []*pb.Resource
- func SortResources(s commands.Resources) commands.Resources
- func StringToApplicationProtocol(p string) commands.Connection_Protocol
- func TestResourceLightInstanceHref(id string) string
- func TestResourceSwitchesInstanceHref(id string) string
- func WaitForDevice(t *testing.T, client pb.GrpcGateway_SubscribeToEventsClient, ...)
- type Option
Constants ¶
View Source
const (
TestResourceSwitchesHref = "/switches"
)
Variables ¶
View Source
var ( CertIdentity = "00000000-0000-0000-0000-000000000001" MfgCert = []byte(`-----BEGIN CERTIFICATE----- MIIB9zCCAZygAwIBAgIRAOwIWPAt19w7DswoszkVIEIwCgYIKoZIzj0EAwIwEzER MA8GA1UEChMIVGVzdCBPUkcwHhcNMTkwNTAyMjAwNjQ4WhcNMjkwMzEwMjAwNjQ4 WjBHMREwDwYDVQQKEwhUZXN0IE9SRzEyMDAGA1UEAxMpdXVpZDpiNWEyYTQyZS1i Mjg1LTQyZjEtYTM2Yi0wMzRjOGZjOGVmZDUwWTATBgcqhkjOPQIBBggqhkjOPQMB BwNCAAQS4eiM0HNPROaiAknAOW08mpCKDQmpMUkywdcNKoJv1qnEedBhWne7Z0jq zSYQbyqyIVGujnI3K7C63NRbQOXQo4GcMIGZMA4GA1UdDwEB/wQEAwIDiDAzBgNV HSUELDAqBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMBBgorBgEEAYLefAEG MAwGA1UdEwEB/wQCMAAwRAYDVR0RBD0wO4IJbG9jYWxob3N0hwQAAAAAhwR/AAAB hxAAAAAAAAAAAAAAAAAAAAAAhxAAAAAAAAAAAAAAAAAAAAABMAoGCCqGSM49BAMC A0kAMEYCIQDuhl6zj6gl2YZbBzh7Th0uu5izdISuU/ESG+vHrEp7xwIhANCA7tSt aBlce+W76mTIhwMFXQfyF3awWIGjOcfTV8pU -----END CERTIFICATE----- `) MfgKey = []byte(`-----BEGIN EC PRIVATE KEY----- MHcCAQEEIMPeADszZajrkEy4YvACwcbR0pSdlKG+m8ALJ6lj/ykdoAoGCCqGSM49 AwEHoUQDQgAEEuHojNBzT0TmogJJwDltPJqQig0JqTFJMsHXDSqCb9apxHnQYVp3 u2dI6s0mEG8qsiFRro5yNyuwutzUW0Dl0A== -----END EC PRIVATE KEY----- `) MfgTrustedCA = []byte(`-----BEGIN CERTIFICATE----- MIIBaTCCAQ+gAwIBAgIQR33gIB75I7Vi/QnMnmiWvzAKBggqhkjOPQQDAjATMREw DwYDVQQKEwhUZXN0IE9SRzAeFw0xOTA1MDIyMDA1MTVaFw0yOTAzMTAyMDA1MTVa MBMxETAPBgNVBAoTCFRlc3QgT1JHMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE xbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4hVdwIsy/5U+3U vM/vdK5wn2+NrWy45vFAJqNFMEMwDgYDVR0PAQH/BAQDAgEGMBMGA1UdJQQMMAoG CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0RBAQwAoIAMAoGCCqGSM49 BAMCA0gAMEUCIBWkxuHKgLSp6OXDJoztPP7/P5VBZiwLbfjTCVRxBvwWAiEAnzNu 6gKPwtKmY0pBxwCo3NNmzNpA6KrEOXE56PkiQYQ= -----END CERTIFICATE----- `) MfgTrustedCAKey = []byte(`-----BEGIN EC PRIVATE KEY----- MHcCAQEEICzfC16AqtSv3wt+qIbrgM8dTqBhHANJhZS5xCpH6P2roAoGCCqGSM49 AwEHoUQDQgAExbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4h VdwIsy/5U+3UvM/vdK5wn2+NrWy45vFAJg== -----END EC PRIVATE KEY----- `) )
View Source
var ( TestDeviceName string TestDeviceNameWithOicResObservable string TestDevsimResources []schema.ResourceLink TestDevsimBackendResources []schema.ResourceLink )
Functions ¶
func AddDeviceSwitchResources ¶
func AddDeviceSwitchResources(ctx context.Context, t *testing.T, deviceID string, c pb.GrpcGatewayClient, resourceIDs ...string) []schema.ResourceLink
func AssertToCheckFunc ¶
func CheckProtobufs ¶
func CheckResource ¶
func CleanUpResourcesArray ¶
func DecodeCbor ¶
func DefaultSwitchResourceLink ¶
func DefaultSwitchResourceLink(deviceID, id string) schema.ResourceLink
func EncodeToCbor ¶
func FieldJsonTag ¶
Get json tag of field with given name in struct v
func FilterResourceLink ¶
func FilterResourceLink(filter func(schema.ResourceLink) bool, links []schema.ResourceLink) []schema.ResourceLink
func FindDeviceByName ¶
func GetAllBackendResourceLinks ¶
func GetAllBackendResourceLinks() []schema.ResourceLink
func GetRootCertificateAuthorities ¶
func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate
func IsDiscoveryResourceBatchObservable ¶ added in v2.3.7
func MakeSwitchResourceData ¶
func MakeSwitchResourceDefaultData ¶
func MakeSwitchResourceDefaultData() map[string]interface{}
func MustFindDeviceByName ¶
func MustGetHostname ¶
func MustGetHostname() string
func OffBoardDevSim ¶ added in v2.7.8
func OnboardDevSim ¶
func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, deviceID, hubEndpoint string, expectedResources []schema.ResourceLink) (string, func())
func OnboardDevSimForClient ¶
func OnboardDevSimForClient(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, clientID, deviceID, hubEndpoint string, expectedResources []schema.ResourceLink) (string, func())
func ProtobufToInterface ¶
func RequireToCheckFunc ¶
func ResourceLinksToResourceIds ¶
func ResourceLinksToResourceIds(deviceID string, s []schema.ResourceLink) []*commands.ResourceId
func ResourceLinksToResources ¶
func ResourceLinksToResources(deviceID string, s []schema.ResourceLink) []*commands.Resource
func ResourceLinksToResources2 ¶
func ResourceLinksToResources2(deviceID string, s []schema.ResourceLink) []*pb.Resource
func StringToApplicationProtocol ¶ added in v2.7.0
func StringToApplicationProtocol(p string) commands.Connection_Protocol
func WaitForDevice ¶ added in v2.3.1
func WaitForDevice(t *testing.T, client pb.GrpcGateway_SubscribeToEventsClient, deviceID, subID, correlationID string, expectedResources []schema.ResourceLink)
Types ¶
type Option ¶ added in v2.5.0
type Option interface {
// contains filtered or unexported methods
}
Option interface used for setting optional sdkConfig properties.
func WithID ¶ added in v2.5.0
WithID creates Option that overrides the default device ID used by the SDK client.
func WithRootCA ¶ added in v2.6.0
WithID creates Option that overrides the certificate authority used by the SDK client.
func WithValidity ¶ added in v2.7.14
WithValidity creates Option that overrides the ValidFrom timestamp and CertExpiry interval used by the SDK client when generating certificates.
Click to show internal directories.
Click to hide internal directories.