Azure / iotedge-lorawan-starterkit

Sample implementation of LoRaWAN components to connect LoRaWAN antenna gateway running IoT Edge directly with Azure IoT.
https://azure.github.io/iotedge-lorawan-starterkit/2.2.1
Other
183 stars 61 forks source link

LNS only supports Amqp_Tcp_Only in Cloud-based mode #2126

Open Metal-Mighty opened 4 months ago

Metal-Mighty commented 4 months ago

Expected Behavior

I would like to be able to choose the communication protocol with the IoT Hub (e.g. Amqp_Tcp_Only, Amqp_Websocket_Only, Mqtt, etc.) in Cloud-Based mode, which was possible when using the Edge Hub.

Current Behavior

The LNS currently only support Amqp_Tcp_Only (see LoRaDeviceFactory.cs#L155), which prevents us from using the same protocol as when using the Edge Hub. Amqp_Tcp_Only uses port 5671 (and 8883 ?) which is not allowed in our firewall.

Our current implementation uses Amqp_Websocket_Only (port 443), and due to strict firewall policies we can't use this mode in our infrastructure. It should be possible to choose the protocol of our choice, as supported in the Edge Hub module with the UpstreamProtocol environment variable.

Steps to Reproduce

  1. Close outbound ports 5671 and 8883 in firewall
  2. Deploy LNS
  3. Connect a gateway to the LNS

-> Connection will get stuck when trying to update the Device Twin

Context (Environment)

Device (Host) Operating System

Ubuntu 20.04

Architecture

amd64

Container Operating System

Linux containers

LoRaWAN Module Version

v2.2.2

Docker

26.1.1-1

Logs

Additional Information

When ports are blocked, the communication gets stuck indefinitely in LoRaDeviceClient.cs#L106.

I forked the project and tried adding Amqp_Websocket_Only as a second protocol in transportSettings (LoRaDeviceFactory.cs#L155 but it won't connect. It only works when only Amqp_Websocket_Only is present. But I may be missing something :)