Skip to content

End-to-end solution for testing an Azure IoT Edge pipeline

License

Notifications You must be signed in to change notification settings

sebader/iotedge-end2end

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure IoT Edge - End2End testing loop

This solution is an end-to-end solution to test a full Azure IoT Edge setup. It consists of two parts:

  1. Two Azure Functions that run in the cloud
  2. Two custom modules running on the Edge

The testing loop is started by a timer-triggered (every couple of minutes) Azure Function (Direct Method Caller), which attempts to execute a direct method on a module running in IoT Edge (Direct Method Receiver). This module creates a new IoT messages and sends it to the Edge Hub. The message gets routed to the next module (Message Forwarder). This one forwards the message back to the Edge Hub where another route sends the message to the IoT Hub back in Azure ("$upstream"). In the cloud, a second Function is triggered by new telemetry messages on the IoT Hub. This concludes the complete loop.

All steps in the cycle are getting logged into Application Insights. This enables reporting and alerting if there are any errors at any point in the loop - and also about the end to end duration of the message from the start in the cloud until it is being received again in the cloud.

architecture

How to deploy / run the solution

  1. Create an Azure Function instance. Also create an Application Insights instance.
  2. Create an Azure IoT Hub
    • Create a consumer group on the Event Hub compatible endpoint call receiverfunction
  3. Create an Edge device in the IoT Hub
  4. Deploy the two modules to your Edge device (folder EdgeModules) and set the routing accordingly (see deployment.template.json for reference). Make sure to set the instrumentation key of your Application Insights instance.
  5. Set the following settings in the Azure Function Application settings:1
    • iothubowner_cs => The IoT Hub Owner connection string of your IoT Hub
    • iothubevents_cs => The connection string of the built-in Event Hub compatible endpoint of your IoT Hub
    • destinationmodules => Comma-separates list of Edge module IDs of Direct Method Receiver modules, e.g. ("edgedevice1/DirectMethodReceiver")
  6. Deploy the two Functions (folder CloudFunctions)

Now, the Function should trigger (default: every 2 minutes) and start the flow. After a few minutes, you should be able to see log messages in Application Insights. If you run into any problems or have questions, feel free to open an issue here in the repo.


1: I recommend to use Azure Key Vault to store your secret app settings such as connections strings

About

End-to-end solution for testing an Azure IoT Edge pipeline

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages