Different structure for rx_metadata for gateways from the packet broker

Hello,

I would like to set up a monitoring view for the gateways. The data from rx_metadata is part of my considerations.
It is clear and understandable that there are differences between the data of gateways from the TTN network and from the Packet_Broker.
But why are there different data structures for data from gateways that come via the Packet_Broker?
These are two GWs from a TTI-ZTennant, to which I have access. Both gateways should be configured identically. Nevertheless, rx_metadata provides the following structure for Gateway1:
rx_metadata: {
0:
{
gateway_ids: object
gateway_id: ‘packetbroker’
packet_broker: {};
};
};

the deveui can be found in the packet_broker node, also the netid. (packet_broker.forwarder_net_id, packet_broker.forwarder_gateway_id, packet_broker.forwarder_gateway_eui)

Gateway 2 provides :

rx_metadata: array {
0:
{
gateway_ids:
{
gateway_id: ‘eui-xxxxxxxxxxxxxxxxxxxx’,
eui: ‘xxxxxxxxxxxxxxxxxx’
};
};
};

In this case, the packet_broker_node is missing - and therefore unfortunately also the netID. However, since the EUI’s are only unique within a NetID - is there a way to find the NetID in this structure as well?

Steffen

EUI are globally unique by definition: Extended Unique Identifier (EUI) - definition from the IEEE standards association.

If an EUI appears on multiple networks it can only happen because the same gateway is connected to multiple networks OR because people are using illegal EUI values.

In your case, could it be one gateway is connected to a tenant and the other to the sandbox or both the tenant and the sandbox ?

1 Like

EUI are globally unique by definition: Extended Unique Identifier (EUI) - definition from the IEEE standards association.

If an EUI appears on multiple networks it can only happen because the same gateway is connected to multiple networks OR because people are using illegal EUI values.

Ok, that was a new information for me. So far I have assumed that each manufacturer can assign its own EUIs and that only the LNS cluster ensures that an EUI cannot be assigned twice within a NetID.

Regarding the question about the constellation, I’ll have to check again tomorrow. In my opinion, both GWs are in the TTN, the sensors in the TTI. The only difference is that one GW is a TTIG based on a station and the other is the classic UDP variant.

I’ll get back to you by monday at the latest, thank you very much!

Steffen

Manufacturers actually have to pay for the EUI ranges. They can assign only from the ranges they own.

Unless your name starts with Hel and ends with Tec - then you just put your cat on the keyboard and hope for the best!

Hello,

sorry, I’ve been away for a few days now. Today I looked for two different messages and yes, it seems to be from TTN to TTI and vice versa. Here are two examples:
TTN → TTI

{
“gateway_ids”: {
“gateway_id”: “packetbroker”,
“eui”: “xxxxxxxxxxxxxxxx”
},
“time”: “2024-10-09T06:40:32.856Z”,
“timestamp”: 274380643,
“rssi”: -118,
“channel_rssi”: -118,
“snr”: -3.2,
“location”: {
“latitude”: 51.xxxxxxxxxxxxx,
“longitude”: 12.0252978801727,
“altitude”: 114,xxxxxxxxxxxxx
“source”: “SOURCE_REGISTRY”
},
“uplink_token”: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
“channel_index”: 1,
“gps_time”: “2024-10-09T06:40:32.856Z”,
“received_at”: “2024-10-09T06:40:30.640564661Z”
}

und hier TTI → TTN

{
“gateway_ids”: {
“gateway_id”: “packetbroker”
},
“packet_broker”: {
“message_id”: “01J9R01APMHPGWKDD55E5NHS39”,
“forwarder_net_id”: “000013”,
“forwarder_tenant_id”: “tenant”,
“forwarder_cluster_id”: “eu1.cloud.thethings.industries”,
“forwarder_gateway_eui”: “YYYYYYYYYYYYYYYY”,
“forwarder_gateway_id”: “eui-yyyyyyyyyyyyyyyyy”,
“home_network_net_id”: “000013”,
“home_network_tenant_id”: “ttn”,
“home_network_cluster_id”: “eu1.cloud.thethings.network”
},
“rssi”: -34,
“channel_rssi”: -34,
“snr”: 9.5,
“location”: {
“latitude”: 50.yyyyyyyyyyyy,
“longitude”: 12.yyyyyyyyyyyy
},
“uplink_token”: “yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy///yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy”,
“received_at”: “2024-10-09T06:39:04.914369627Z”
}

The question that now arises is: are there parameters that I have not yet found by means of which the contents of the structures can be adapted (ideally in the direction of more content)?
At least the GatewayID would be helpful, although the NetID would also be useful information for messages outside the TTS. But I can’t say what the structures of such messages look like, I don’t currently have any examples. You would have to ask in Schleswig-H.

Steffen

NetID will always be the same for all messages you get from TTN applications, TTN and TTI use 13 and messages from other operators will not get to the TTN application layer.

Hard to say as we don’t know what you already found :smiley:. However I don’t think there are a lot of settings available however I am not an expert on the TTI offerings and what can be configured, may-be @descartes knows?

1 Like

The overall trend I’ve seen is that there are virtually no modifications available to many aspects of the data formats - not unsurprising given that TTN processes ~1000 uplinks a second (which is where the gateway data would be present) and that gets consolidated down to ~200 uplinks processed through the application server. Any parameters to modify the packets would have to be held in memory and then an extra process to apply them.

I can understand somewhat why we have an include filter on the outgoing web hooks - the hot mess users have generated with the Payload Formatter made it almost trivial to extend that.

My feeling is that we tend to get everything, even if it takes time to understand how it all pieces together - the meta data with the correlation_ids & many timestamps allow a level of audit that I can’t see anyone needing to use given the reality of overall packet loss.

So you can see a complete unredacted but some elements truncated for brevity, here’s a uplink:

{
  "name": "as.up.data.forward",
  "time": "2024-10-09T09:53:04.788975701Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "noder-loradio32-1",
        "application_ids": {
          "application_id": "ttc2024demo"
        },
        "dev_eui": "70B3D57ED80035E6",
        "join_eui": "DE5CA70000000000",
        "dev_addr": "27FDD9B8"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
    "end_device_ids": {
      "device_id": "noder-loradio32-1",
      "application_ids": {
        "application_id": "ttc2024demo"
      },
      "dev_eui": "70B3D57ED80035E6",
      "join_eui": "DE5CA70000000000",
      "dev_addr": "27FDD9B8"
    },
    "correlation_ids": [
      "pba:uplink:01J9RB4HHHKY4B026D5GEF33AW"
    ],
    "received_at": "2024-10-09T09:53:04.784043652Z",
    "uplink_message": {
      "session_key_id": "AZJwi+FwnymyEfCkhJzhTQ==",
      "f_port": 1,
      "f_cnt": 9,
      "frm_payload": "IzAwMDA4",
      "rx_metadata": [
        {
          "gateway_ids": {
            "gateway_id": "packetbroker"
          },
          "packet_broker": {
            "message_id": "01J9RB4HHHKY4B026D5GEF33AW",
            "forwarder_net_id": "000013",
            "forwarder_tenant_id": "ttn",
            "forwarder_cluster_id": "eu1.cloud.thethings.network",
            "forwarder_gateway_eui": "DE5CA70000000001",
            "forwarder_gateway_id": "descartes-m2m-tele-2",
            "home_network_net_id": "000013",
            "home_network_tenant_id": "relay",
            "home_network_cluster_id": "eu2.cloud.thethings.industries"
          },
          "rssi": -78,
          "channel_rssi": -78,
          "snr": 9.2,
          "location": {
            "latitude": 53.57020214072325,
            "longitude": -2.460822713267241,
            "altitude": 191
          },
          "uplink_token": "C--snip--w==",
          "received_at": "2024-10-09T09:53:04.558686389Z"
        },
        {
          "gateway_ids": {
            "gateway_id": "packetbroker"
          },
          "packet_broker": {
            "message_id": "01J9RB4HHTBEM6YG7QFQHTRK9F",
            "forwarder_net_id": "000013",
            "forwarder_tenant_id": "ttnv2",
            "forwarder_cluster_id": "ttn-v2-legacy-eu",
            "forwarder_gateway_eui": "DE5CA70000000000",
            "forwarder_gateway_id": "eui-de5ca70000000000",
            "home_network_net_id": "000013",
            "home_network_tenant_id": "relay",
            "home_network_cluster_id": "eu2.cloud.thethings.industries"
          },
          "rssi": -90,
          "channel_rssi": -90,
          "snr": 9,
          "location": {
            "latitude": 53.57029618,
            "longitude": -2.46078611,
            "altitude": 134
          },
          "uplink_token": "CC--snip--r=",
          "received_at": "2024-10-09T09:53:04.565339273Z"
        },
        {
          "gateway_ids": {
            "gateway_id": "loradio1302-relay-demo-pf",
            "eui": "70B3D57ED80035E8"
          },
          "timestamp": 270001085,
          "rssi": -65,
          "channel_rssi": -65,
          "snr": 13.5,
          "frequency_offset": "-146",
          "uplink_token": "CiC--snip--rc=",
          "channel_index": 7,
          "received_at": "2024-10-09T09:53:04.585007973Z"
        },
        {
          "gateway_ids": {
            "gateway_id": "packetbroker"
          },
          "packet_broker": {
            "message_id": "01J9RB4HJF3A2JSQ7MBJ8ZV897",
            "forwarder_net_id": "000013",
            "forwarder_tenant_id": "ttn",
            "forwarder_cluster_id": "eu1.cloud.thethings.network",
            "forwarder_gateway_eui": "EC656EFFFE000208",
            "forwarder_gateway_id": "top-secret-product",
            "home_network_net_id": "000013",
            "home_network_tenant_id": "relay",
            "home_network_cluster_id": "eu2.cloud.thethings.industries"
          },
          "rssi": -82.399994,
          "signal_rssi": -82.399994,
          "channel_rssi": -82.399994,
          "snr": 12,
          "location": {
            "latitude": 53.570311,
            "longitude": -2.4606596,
            "altitude": 124,
            "accuracy": 13
          },
          "uplink_token": "C--snip--r",
          "received_at": "2024-10-09T09:53:04.589182532Z"
        }
      ],
      "settings": {
        "data_rate": {
          "lora": {
            "bandwidth": 125000,
            "spreading_factor": 7,
            "coding_rate": "4/5"
          }
        },
        "frequency": "867900000"
      },
      "received_at": "2024-10-09T09:53:04.577765171Z",
      "consumed_airtime": "0.051456s",
      "network_ids": {
        "net_id": "000013",
        "ns_id": "EC656E0000103598",
        "tenant_id": "relay",
        "cluster_id": "eu2",
        "cluster_address": "eu2.cloud.thethings.industries",
        "tenant_address": "relay.eu2.cloud.thethings.industries"
      }
    }
  },
  "correlation_ids": [
    "pba:uplink:01J9RB4HHHKY4B026D5GEF33AW"
  ],
  "origin": "ip-10-24-15-176.eu-west-2.compute.internal",
  "context": {
    "tenant-id": "CgVyZWxheQ=="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01J9RB4HRMJ5WKEGSKMC7W05ZP"
}


This device noder-loradio32-1 is on a Discovery instance to test out some new LW functionality. That instance has a gateway on it - loradio1302-relay-demo-pf. There are two gateways on TTN - descartes-m2m-tele-2 and top-secret-product. There is also a gateway on the old v2 cluster (for testing/monitoring) - eui-de5ca70000000000.

I think this provides a pretty comprehensive example of what you are likely to pickup - other combinations may exist and I haven’t cross referenced with your JSON so you may see other details.

All that said, what are you hoping to achieve. For me the “ultimate” monitoring logs lines for each gateway for an uplink with the signal quality, plus update the gateway record with last heard. I can then run scripts to check for devices only heard by one or two gateways and/or gateway overlap/coverage plus the obvious, missing gateway - which can either by just on a periodic check against last heard or for the more paranoid, when devices that are normally heard uplink but the gateway isn’t in the meta data.

So, what do you need?

2 Likes

NetID will always be the same for all messages you get from TTN applications, TTN and TTI use 13 and messages from other operators will not get to the TTN application layer.

Thats right, I know. But, as I already wrote, I can’t rule out the possibility of receiving data from other providers - that’s why I wanted to include the NetID.

Thanx for your support. :grinning:

I would like to include various aspects in my gateway monitoring. These would be

  • Data from the packet broker and TTS stack gateway APIs
  • Data from the individual messages, provided that rx_metadata contains (my own) gateways that are relevant to me.
  • possibly later SNMP data from the gateways

With SNR/ RSSI and the position data of the nodes, a reverse TTN mapper could be set up to show how an individual gateway supplies its environment and where further densification of the network by means of additional gateways might be useful.

As the solution addresses a heterogeneous clientele, which operates an equally heterogeneous gateway portfolio. I would therefore like to use data sources that are not based on a proprietary gateway management solution from individual manufacturers.

I want to display these in a meaningful way for the user, so the DeviceID makes more sense in the visualization than the EUI. Since I cannot rule out the possibility that all data comes from TheThingsStack networks (the trend in the region is increasingly towards networking different networks such as Zenner, Digimondo etc., see https://nodes.sh), I would also like to reliably determine the NetID of the forwarder network.

Steffen

I suspect you are over thinking some of the elements above - lots of data analysis that 95% of people won’t worry about or even appreciate - the very definition of analysis paralysis. And I’m not sure you are missing any of the data you need.

The absolutely best thing is to start filling up a database, do some poking about and then move on to creating some reports / charts / status boards and evolve from there.

And there’s more:

{
  "name": "as.up.data.forward",
  "time": "2024-10-11T11:58:28.980141197Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "noder-loradio32-1",
        "application_ids": {
          "application_id": "ttc2024demo"
        },
        "dev_eui": "70B3D57ED80035E6",
        "join_eui": "DE5CA70000000000",
        "dev_addr": "27FDD9BF"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
    "end_device_ids": {
      "device_id": "noder-loradio32-1",
      "application_ids": {
        "application_id": "ttc2024demo"
      },
      "dev_eui": "70B3D57ED80035E6",
      "join_eui": "DE5CA70000000000",
      "dev_addr": "27FDD9BF"
    },
    "correlation_ids": [
      "gs:uplink:01J9XQ3K6PE4SKZWSDPEGXG7FM"
    ],
    "received_at": "2024-10-11T11:58:28.977394531Z",
    "uplink_message": {
      "session_key_id": "AZJ64UY9opB7D3jRpqDMJQ==",
      "f_port": 1,
      "f_cnt": 79,
      "frm_payload": "IzAwMDc4",
      "rx_metadata": [
        {
          "gateway_ids": {
            "gateway_id": "relay"
          },
          "relay": {
            "device_id": "the-relay"
          },
          "rssi": -45,
          "channel_rssi": -45,
          "snr": -1,
          "uplink_token": "C-snip-A=",
          "received_at": "2024-10-11T11:58:28.379315714Z"
        }
      ],
      "settings": {
        "data_rate": {
          "lora": {
            "bandwidth": 125000,
            "spreading_factor": 7,
            "coding_rate": "4/5"
          }
        },
        "frequency": "867100000"
      },
      "received_at": "2024-10-11T11:58:28.772154623Z",
      "consumed_airtime": "0.051456s",
      "network_ids": {
        "net_id": "000013",
        "ns_id": "EC656E0000103598",
        "tenant_id": "relay",
        "cluster_id": "eu2",
        "cluster_address": "eu2.cloud.thethings.industries",
        "tenant_address": "relay.eu2.cloud.thethings.industries"
      }
    }
  },
  "correlation_ids": [
    "gs:uplink:01J9XQ3K6PE4SKZWSDPEGXG7FM"
  ],
  "origin": "ip-10-24-7-224.eu-west-2.compute.internal",
  "context": {
    "tenant-id": "CgVyZWxheQ=="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01J9XQ3KKMX9CREH4H944ZPX70"
}

This device appears to have a rather odd gateway - it’s because it’s uplink has been routed via a relay - a device that can listen for uplinks and pass them on as per LA spec TS0111

Here’s the relay’s meta for that uplink which shows the gateway that received the relay message:

{
  "name": "as.up.data.forward",
  "time": "2024-10-11T11:58:28.777698213Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "the-relay",
        "application_ids": {
          "application_id": "ttc2024demo"
        },
        "dev_eui": "70B3D57ED80035E5",
        "join_eui": "DECA700000000000",
        "dev_addr": "27FDD9B9"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ApplicationUp",
    "end_device_ids": {
      "device_id": "the-relay",
      "application_ids": {
        "application_id": "ttc2024demo"
      },
      "dev_eui": "70B3D57ED80035E5",
      "join_eui": "DECA700000000000",
      "dev_addr": "27FDD9B9"
    },
    "correlation_ids": [
      "gs:uplink:01J9XQ3K6PE4SKZWSDPEGXG7FM"
    ],
    "received_at": "2024-10-11T11:58:28.772429885Z",
    "uplink_message": {
      "session_key_id": "AZJ63gQ6ugJDYotLgZobqQ==",
      "f_port": 226,
      "f_cnt": 112,
      "rx_metadata": [
        {
          "gateway_ids": {
            "gateway_id": "loradio1302-relay-demo-pf",
            "eui": "70B3D57ED80035E8"
          },
          "timestamp": 991988668,
          "rssi": -64,
          "channel_rssi": -64,
          "snr": 8.8,
          "frequency_offset": "427",
          "uplink_token": "C-snip-c",
          "channel_index": 2,
          "received_at": "2024-10-11T11:58:28.511491714Z"
        }
      ],
      "settings": {
        "data_rate": {
          "lora": {
            "bandwidth": 125000,
            "spreading_factor": 7,
            "coding_rate": "4/5"
          }
        },
        "frequency": "868500000",
        "timestamp": 991988668
      },
      "received_at": "2024-10-11T11:58:28.567420095Z",
      "consumed_airtime": "0.082176s",
      "network_ids": {
        "net_id": "000013",
        "ns_id": "EC656E0000103598",
        "tenant_id": "relay",
        "cluster_id": "eu2",
        "cluster_address": "eu2.cloud.thethings.industries",
        "tenant_address": "relay.eu2.cloud.thethings.industries"
      }
    }
  },
  "correlation_ids": [
    "gs:uplink:01J9XQ3K6PE4SKZWSDPEGXG7FM"
  ],
  "origin": "ip-10-24-15-176.eu-west-2.compute.internal",
  "context": {
    "tenant-id": "CgVyZWxheQ=="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01J9XQ3KD9GDW6AGJWRF11QB46"
}