Virtual

As part of the Edge Xpert distribution, IOTech provides a Virtual Device Service that allows simple simulation data to be easily ingested to the Edge Xpert platform. This allows you to manipulate data using the Edge Xpert platform and verify data flows to other microservices without the need for physical devices. This is especially useful for the following:

  • Learning how Edge Xpert works
  • Functional and performance testing

The Virtual Device Service supports the following key features:

  • Reading data
  • Writing data

The Virtual Device Service supports the following data types:

  • Boolean
  • UInt8, UInt16, UInt32, UInt64
  • Int8, Int16, Int32, Int64
  • Float32
  • Float64

Virtual Device Profiles

The following device profiles are supplied for use with the Virtual Device Service:

Virtual Device Profiles
Profile Name YAML File
Random-Boolean-Device device.virtual.bool.yaml
Random-Integer-Device device.virtual.int.yaml
Random-UnsignedInteger-Device device.virtual.uint.yaml
Random-Float-Device device.virtual.float.yaml

All the profile files mentioned above are located in the /device-virtual/cmd/res/ folder.

minimum and maximum Parameters

The minimum parameter specifies the smallest value that can be returned.

The maximum parameter specifies the largest value that can be returned.

Minimum and maximum values can be specified in the device profile, as illustrated in the following extract:

deviceResources:
 -
  name: "RandomValue_Int8"
  description: "Generate random int8 value"
  properties:
    value:
      { type: "Int8", readWrite: "R", minimum: "-100", maximum: "100", defaultValue: "0" }
    units:
      { type: "String", readWrite: "R", defaultValue: "random int8 value" }

EnableRandomization_<type> Parameter

The EnableRandomization_<type> parameter determines whether the resource returns a random or fixed value.

The parameter is always true, unless set to false in the same request as that specifying a fixed value.

Core Command APIs

Invoking the Core Command Service API can retrieve the commands provided by the pre-definded device, as shown in the following table:

Virtual Device Profiles
Device API Retrieval Command
Random-Boolean-Device http://[host]:48082/api/v1/device/name/Random-Boolean-Device
Random-Integer-Device http://[host]:48082/api/v1/device/name/Random-Integer-Device
Random-UnsignedInteger-Device http://[host]:48082/api/v1/device/name/Random-UnsignedInteger-Device
Random-Float-Device http://[host]:48082/api/v1/device/name/Random-Float-Device

Virtual Device Service Examples

The following examples illustrate how the Virtual Device Device Service can be used:

This example assumes that the Edge Xpert services are running with at least the --xpert-manager and --device-virtual parameters. A suitable command would be as follows:

edgexpert up --xpert-manager --device-virtual

For further examples see the Edge Xpert Manager sections, which use the Virtual Device Service to walk-through the user interface.