Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Generic error while provisioning device in LoRaWAN. #169

Open
Anupamskd7 opened this issue Nov 17, 2022 · 1 comment
Open

Entity Generic error while provisioning device in LoRaWAN. #169

Anupamskd7 opened this issue Nov 17, 2022 · 1 comment

Comments

@Anupamskd7
Copy link

Anupamskd7 commented Nov 17, 2022

Hi @jason-fox, Could you please help me in understanding this,

Description:

Unable to Provision device in IoTAgent LoRaWAN with Scorpio broker v2.1.13 as context broker.

Steps to reproduce:

Make the following changes in config.js file:

  contextBroker: {

       host: 'gateway.default.svc.cluster.local',

       port: '9090',

       ngsiVersion: 'ld'
   }

Send the device Provisioning request to the 4061 port of IoTAgent LoRaWAN as follows:

curl --location --request POST 'http://localhost:4061/iot/devices' \
--header 'accept: application/json' \
--header 'Fiware-Service: Weather' \
--header 'Fiware-ServicePath: /' \
--header 'Content-Type: application/json'

-d '{
  "devices": [
    {
      "device_id": "loradev01",
      "entity_name": "urn:ngsi-ld:LoraDevice:loraent01",
      "entity_type": "LoraDevice",
      "timezone": "America/Santiago",
      "attributes": [
        {
          "object_id": "bp0",
          "name": "barometric_pressure_0",
          "type": "hpa"
        },
        {
          "object_id": "di3",
          "name": "digital_in_3",
          "type": "Number"
        },
        {
          "object_id": "do4",
          "name": "digital_out_4",
          "type": "Number"
        },
        {
          "object_id": "rh2",
          "name": "relative_humidity_2",
          "type": "Number"
        },
        {
          "object_id": "t1",
          "name": "temperature_1",
          "type": "Number"
        }
      ],
      "internal_attributes": {
        "lorawan": {
          "application_server": {
            "host": "mqtt.default.svc.cluster.local",
            "username": "admin",
            "password": "password",
            "provider": "TTN"
          },
          "dev_eui": "1119343755556A14",
          "app_eui": "4569343567897875",
          "application_id": "demoTTN",
          "application_key": "444B8EF16415B5F6ED777EAFE695C49",
          "data_model": "cayennelpp"
        }
      }
    }
  ]
}'

Expected Output:

200 OK
Device should get created.

Actual Output:

{
    "name": "ENTITY_GENERIC_ERROR",
    "message": "Error accesing entity data for device: loradev01 of type: LoraDevice"
}

Logs:


*********************************************** 
WARNING: It is recommended to enable authentication for secure connection 
*********************************************** 
INFO: IoT Agent running standalone 
{"time":"2022-11-17T05:54:32.068Z","lvl":"ERROR","msg":"EISDIR: illegal operation on a directory, read"} 
{"op":"IoTAgentNGSI.JEXL","time":"2022-11-17T05:54:33.586Z","lvl":"INFO","msg":"Trasformations can be added to JEXL parser"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_CB_HOST to environment value: gateway.default.svc.cluster.local"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_CB_PORT to environment value: 9090"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_NORTH_PORT to environment value: 4061"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_PROVIDER_URL to environment value: http://iotagent-lorawan:4061"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_REGISTRY_TYPE to environment value: mongodb"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_LOG_LEVEL to environment value: DEBUG"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_MONGO_HOST to environment value: mongo-common-0.mongo-common"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_MONGO_PORT to environment value: 27017"} 
{"time":"2022-11-17T05:54:33.791Z","lvl":"INFO","msg":"Setting IOTA_MONGO_DB to environment value: iotagentlorawan"} 
{"time":"2022-11-17T05:54:33.792Z","lvl":"WARN","msg":"***********************************************\nWARNING: authentication for secure connections is not in use,\nIt is recommended to enable authentication\n***********************************************"} 
time=2022-11-17T05:54:33.792Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Starting an IoT Agent... | comp=IoTAgent 
time=2022-11-17T05:54:33.793Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_CB_HOST to environment value: gateway.default.svc.cluster.local | comp=IoTAgent 
time=2022-11-17T05:54:33.793Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_CB_PORT to environment value: 9090 | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_NORTH_PORT to environment value: 4061 | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_PROVIDER_URL to environment value: http://iotagent-lorawan:4061 | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_REGISTRY_TYPE to environment value: mongodb | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_LOG_LEVEL to environment value: DEBUG | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_HOST to environment value: mongo-common-0.mongo-common | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_PORT to environment value: 27017 | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_DB to environment value: iotagentlorawan | comp=IoTAgent 
time=2022-11-17T05:54:33.794Z | lvl=WARN | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=*********************************************** 
WARNING: authentication for secure connections is not in use, 
It is recommended to enable authentication 
*********************************************** | comp=IoTAgent 
time=2022-11-17T05:54:33.795Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Default expression language not set, or invalid, using legacy configuration | comp=IoTAgent 
time=2022-11-17T05:54:33.795Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_CB_HOST to environment value: gateway.default.svc.cluster.local | comp=IoTAgent 
time=2022-11-17T05:54:33.795Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_CB_PORT to environment value: 9090 | comp=IoTAgent 
time=2022-11-17T05:54:33.804Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_NORTH_PORT to environment value: 4061 | comp=IoTAgent 
time=2022-11-17T05:54:33.804Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_PROVIDER_URL to environment value: http://iotagent-lorawan:4061 | comp=IoTAgent 
time=2022-11-17T05:54:33.804Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_REGISTRY_TYPE to environment value: mongodb | comp=IoTAgent 
time=2022-11-17T05:54:33.804Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_LOG_LEVEL to environment value: DEBUG | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_HOST to environment value: mongo-common-0.mongo-common | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_PORT to environment value: 27017 | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Setting IOTA_MONGO_DB to environment value: iotagentlorawan | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=WARN | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=*********************************************** 
WARNING: authentication for secure connections is not in use, 
It is recommended to enable authentication 
*********************************************** | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=Activating IOT Agent NGSI Library. | comp=IoTAgent 
time=2022-11-17T05:54:33.805Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=MongoDB Device registry selected for NGSI Library | comp=IoTAgent 
time=2022-11-17T05:54:33.911Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DbConn | from=n/a | srv=n/a | subsrv=n/a | msg=First connection attempt | comp=IoTAgent 
time=2022-11-17T05:54:33.911Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DbConn | from=n/a | srv=n/a | subsrv=n/a | msg=Attempting to connect to MongoDB instance with url "mongodb://mongo-common-0.mongo-common:27017/iotagentlorawan" and options {}. Attempt 1 | comp=IoTAgent 
(node:8) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor. 
time=2022-11-17T05:54:34.318Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DbConn | from=n/a | srv=n/a | subsrv=n/a | msg=Successfully connected to MongoDB. | comp=IoTAgent 
time=2022-11-17T05:54:34.328Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.NorthboundServer | from=n/a | srv=n/a | subsrv=n/a | msg=Starting IoT Agent listening on port [4061] | comp=IoTAgent 
time=2022-11-17T05:54:34.328Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.NorthboundServer | from=n/a | srv=n/a | subsrv=n/a | msg=Using config: 
 
{ 
    "logLevel": "DEBUG", 
    "timestamp": true, 
    "contextBroker": { 
        "host": "gateway.default.svc.cluster.local", 
        "port": "9090", 
        "ngsiVersion": "ld", 
        "url": "http://gateway.default.svc.cluster.local:9090", 
        "fallbackTenant": "iotagent", 
        "fallbackPath": "/" 
    }, 
    "server": { 
        "port": "4061" 
    }, 
    "defaultResource": "/iot/d", 
    "deviceRegistry": { 
        "type": "mongodb" 
    }, 
    "mongodb": { 
        "host": "mongo-common-0.mongo-common", 
        "port": "27017", 
        "db": "iotagentlorawan" 
    }, 
    "types": {}, 
    "service": "howtoService", 
    "subservice": "/howto", 
    "providerUrl": "http://iotagent-lorawan:4061", 
    "deviceRegistrationDuration": "P1Y", 
    "defaultType": "Thing", 
    "iotaVersion": "1.2.5", 
    "multiCore": false, 
    "relaxTemplateValidation": false, 
    "defaultEntityNameConjunction": ":", 
    "defaultExpressionLanguage": "legacy" 
} 
 | comp=IoTAgent 
time=2022-11-17T05:54:34.337Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.ContextServer-LD | from=n/a | srv=n/a | subsrv=n/a | msg=Loading NGSI-LD Context server routes | comp=IoTAgent 
time=2022-11-17T05:54:34.343Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=iotagent-node-lib activated | comp=IoTAgent 
time=2022-11-17T05:54:34.343Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.JEXL | from=n/a | srv=n/a | subsrv=n/a | msg=Trasformations can be added to JEXL parser | comp=IoTAgent 
time=2022-11-17T05:54:34.344Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Loading types from configuration file | comp=IoTAgent 
time=2022-11-17T05:54:34.344Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Loading services from registry | comp=IoTAgent 
time=2022-11-17T05:54:34.360Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Loading devices from registry | comp=IoTAgent 
time=2022-11-17T05:54:34.390Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Executable | from=n/a | srv=n/a | subsrv=n/a | msg=LoRaWAN IoT Agent started | comp=IoTAgent 
time=2022-11-17T05:56:13.509Z | lvl=DEBUG | corr=9f1269c3-bf83-4630-a599-e36d77989b21 | trans=9f1269c3-bf83-4630-a599-e36d77989b21 | op=IoTAgentNGSI.GenericMiddlewares | from=172.30.80.220 | srv=Weather | subsrv=/ | msg=Request for path [/iot/devices] from [iotagent-lorawan:4061] | comp=IoTAgent 
time=2022-11-17T05:56:13.509Z | lvl=DEBUG | corr=9f1269c3-bf83-4630-a599-e36d77989b21 | trans=9f1269c3-bf83-4630-a599-e36d77989b21 | op=IoTAgentNGSI.GenericMiddlewares | from=172.30.80.220 | srv=Weather | subsrv=/ | msg=Body: 
 
{ 
    "devices": [ 
        { 
            "device_id": "loradev01", 
            "entity_name": "urn:ngsi-ld:LoraDevice:loraent01", 
            "entity_type": "LoraDevice", 
            "timezone": "America/Santiago", 
            "attributes": [ 
                { 
                    "object_id": "bp0", 
                    "name": "barometric_pressure_0", 
                    "type": "hpa" 
                }, 
                { 
                    "object_id": "di3", 
                    "name": "digital_in_3", 
                    "type": "Number" 
                }, 
                { 
                    "object_id": "do4", 
                    "name": "digital_out_4", 
                    "type": "Number" 
                }, 
                { 
                    "object_id": "rh2", 
                    "name": "relative_humidity_2", 
                    "type": "Number" 
                }, 
                { 
                    "object_id": "t1", 
                    "name": "temperature_1", 
                    "type": "Number" 
                } 
            ], 
            "internal_attributes": { 
                "lorawan": { 
                    "application_server": { 
                        "host": "mqtt.default.svc.cluster.local", 
                        "username": "admin", 
                        "password": "password", 
                        "provider": "TTN" 
                    }, 
                    "dev_eui": "1119343755556A14", 
                    "app_eui": "4569343567897875", 
                    "application_id": "demoTTN", 
                    "application_key": "444B8EF16415B5F6ED777EAFE695C49", 
                    "data_model": "cayennelpp" 
                } 
            } 
        } 
    ] 
} 
 
 | comp=IoTAgent 
time=2022-11-17T05:56:13.512Z | lvl=DEBUG | corr=9f1269c3-bf83-4630-a599-e36d77989b21 | trans=9f1269c3-bf83-4630-a599-e36d77989b21 | op=IoTAgentNGSI.DeviceProvisioning | from=172.30.80.220 | srv=Weather | subsrv=/ | msg=Handling device provisioning request. | comp=IoTAgent 
time=2022-11-17T05:56:13.513Z | lvl=DEBUG | corr=9f1269c3-bf83-4630-a599-e36d77989b21 | trans=9f1269c3-bf83-4630-a599-e36d77989b21 | op=IoTAgentNGSI.MongoDBGroupRegister | from=172.30.80.220 | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","type","apikey"] with queryObj {"service":"Weather","subservice":"/","type":"LoraDevice"} | comp=IoTAgent 
time=2022-11-17T05:56:13.519Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Device group for fields [["service","subservice","type","apikey"]] not found: [{"service":"Weather","subservice":"/","type":"LoraDevice"}] | comp=IoTAgent 
time=2022-11-17T05:56:13.520Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","apikey"] with queryObj {"service":"Weather","subservice":"/"} | comp=IoTAgent 
(node:8) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. 
time=2022-11-17T05:56:13.522Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Device group for fields [["service","subservice","apikey"]] not found: [{"service":"Weather","subservice":"/"}] | comp=IoTAgent 
time=2022-11-17T05:56:13.524Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.BidirectionalPlugin | from=n/a | srv=n/a | subsrv=n/a | msg=Extracting attribute list | comp=IoTAgent 
time=2022-11-17T05:56:13.524Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.BidirectionalPlugin | from=n/a | srv=n/a | subsrv=n/a | msg=Sending bidirectionality subscriptions for device [loradev01] | comp=IoTAgent 
time=2022-11-17T05:56:13.525Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Device provisioning:{"id":"loradev01","type":"LoraDevice","name":"urn:ngsi-ld:LoraDevice:loraent01","service":"Weather","subservice":"/","active":[{"object_id":"bp0","name":"barometric_pressure_0","type":"hpa"},{"object_id":"di3","name":"digital_in_3","type":"Number"},{"object_id":"do4","name":"digital_out_4","type":"Number"},{"object_id":"rh2","name":"relative_humidity_2","type":"Number"},{"object_id":"t1","name":"temperature_1","type":"Number"}],"timezone":"America/Santiago","internalAttributes":{"lorawan":{"application_server":{"host":"mqtt.default.svc.cluster.local","username":"admin","password":"password","provider":"TTN"},"dev_eui":"1119343755556A14","app_eui":"4569343567897875","application_id":"demoTTN","application_key":"444B8EF16415B5F6ED777EAFE695C49","data_model":"cayennelpp"}},"internalId":null,"subscriptions":[]} | comp=IoTAgent 
time=2022-11-17T05:56:13.525Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Registering Application Server:{"lorawan":{"application_server":{"host":"mqtt.default.svc.cluster.local","username":"admin","password":"password","provider":"TTN"},"dev_eui":"1119343755556A14","app_eui":"4569343567897875","application_id":"demoTTN","application_key":"444B8EF16415B5F6ED777EAFE695C49","data_model":"cayennelpp"}} | comp=IoTAgent 
time=2022-11-17T05:56:13.525Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Creating new LoRaWAN application | comp=IoTAgent 
time=2022-11-17T05:56:13.526Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.MqttClient | from=n/a | srv=n/a | subsrv=n/a | msg=Connecting to MQTT server mqtt://mqtt.default.svc.cluster.local:1883 with options:{"username":"admin","password":"password","clientId":"demoTTN_8e809fb1"} | comp=IoTAgent 
time=2022-11-17T05:56:13.699Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.MqttClient | from=n/a | srv=n/a | subsrv=n/a | msg=Connected to MQTT server | comp=IoTAgent 
time=2022-11-17T05:56:13.699Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.Agent | from=n/a | srv=n/a | subsrv=n/a | msg=Application started. | comp=IoTAgent 
time=2022-11-17T05:56:13.699Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.MqttClient | from=n/a | srv=n/a | subsrv=n/a | msg=Subscribing to MQTT topic: v3/demoTTN/devices/loradev01/up | comp=IoTAgent 
time=2022-11-17T05:56:13.701Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBDeviceRegister | from=n/a | srv=Weather | subsrv=/ | msg=Looking for device with id [loradev01]. | comp=IoTAgent 
time=2022-11-17T05:56:13.704Z | lvl=INFO | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentLoRaWAN.MqttClient | from=n/a | srv=n/a | subsrv=n/a | msg=Successfully subscribed to the following topic: "v3/demoTTN/devices/loradev01/up" | comp=IoTAgent 
time=2022-11-17T05:56:13.704Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBDeviceRegister | from=n/a | srv=Weather | subsrv=/ | msg=Device [loradev01] not found. | comp=IoTAgent 
time=2022-11-17T05:56:13.705Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","type","apikey"] with queryObj {"service":"Weather","subservice":"/","type":"LoraDevice"} | comp=IoTAgent 
time=2022-11-17T05:56:13.709Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Device group for fields [["service","subservice","type","apikey"]] not found: [{"service":"Weather","subservice":"/","type":"LoraDevice"}] | comp=IoTAgent 
time=2022-11-17T05:56:13.709Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","apikey"] with queryObj {"service":"Weather","subservice":"/"} | comp=IoTAgent 
time=2022-11-17T05:56:13.712Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Device group for fields [["service","subservice","apikey"]] not found: [{"service":"Weather","subservice":"/"}] | comp=IoTAgent 
time=2022-11-17T05:56:13.713Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DeviceService | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData before merge with conf: {"id":"loradev01","type":"LoraDevice","name":"urn:ngsi-ld:LoraDevice:loraent01","service":"Weather","subservice":"/","active":[{"object_id":"bp0","name":"barometric_pressure_0","type":"hpa"},{"object_id":"di3","name":"digital_in_3","type":"Number"},{"object_id":"do4","name":"digital_out_4","type":"Number"},{"object_id":"rh2","name":"relative_humidity_2","type":"Number"},{"object_id":"t1","name":"temperature_1","type":"Number"}],"timezone":"America/Santiago","internalAttributes":{"lorawan":{"application_server":{"host":"mqtt.default.svc.cluster.local","username":"admin","password":"password","provider":"TTN"},"dev_eui":"1119343755556A14","app_eui":"4569343567897875","application_id":"demoTTN","application_key":"444B8EF16415B5F6ED777EAFE695C49","data_model":"cayennelpp"}},"internalId":null,"subscriptions":[]} | comp=IoTAgent 
time=2022-11-17T05:56:13.714Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DeviceService | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData after merge with conf: {"id":"loradev01","type":"LoraDevice","name":"urn:ngsi-ld:LoraDevice:loraent01","service":"Weather","subservice":"/","active":[{"object_id":"bp0","name":"barometric_pressure_0","type":"hpa"},{"object_id":"di3","name":"digital_in_3","type":"Number"},{"object_id":"do4","name":"digital_out_4","type":"Number"},{"object_id":"rh2","name":"relative_humidity_2","type":"Number"},{"object_id":"t1","name":"temperature_1","type":"Number"}],"staticAttributes":[],"lazy":null,"commands":[],"timezone":"America/Santiago","internalAttributes":{"lorawan":{"application_server":{"host":"mqtt.default.svc.cluster.local","username":"admin","password":"password","provider":"TTN"},"dev_eui":"1119343755556A14","app_eui":"4569343567897875","application_id":"demoTTN","application_key":"444B8EF16415B5F6ED777EAFE695C49","data_model":"cayennelpp"}},"internalId":null,"subscriptions":[]} | comp=IoTAgent 
time=2022-11-17T05:56:13.714Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DeviceService | from=n/a | srv=n/a | subsrv=n/a | msg=Registering device into NGSI Service: 
{ 
    "id": "loradev01", 
    "type": "LoraDevice", 
    "name": "urn:ngsi-ld:LoraDevice:loraent01", 
    "service": "Weather", 
    "subservice": "/", 
    "active": [ 
        { 
            "object_id": "bp0", 
            "name": "barometric_pressure_0", 
            "type": "hpa" 
        }, 
        { 
            "object_id": "di3", 
            "name": "digital_in_3", 
            "type": "Number" 
        }, 
        { 
            "object_id": "do4", 
            "name": "digital_out_4", 
            "type": "Number" 
        }, 
        { 
            "object_id": "rh2", 
            "name": "relative_humidity_2", 
            "type": "Number" 
        }, 
        { 
            "object_id": "t1", 
            "name": "temperature_1", 
            "type": "Number" 
        } 
    ], 
    "staticAttributes": [], 
    "lazy": null, 
    "commands": [], 
    "timezone": "America/Santiago", 
    "internalAttributes": { 
        "lorawan": { 
            "application_server": { 
                "host": "mqtt.default.svc.cluster.local", 
                "username": "admin", 
                "password": "password", 
                "provider": "TTN" 
            }, 
            "dev_eui": "1119343755556A14", 
            "app_eui": "4569343567897875", 
            "application_id": "demoTTN", 
            "application_key": "444B8EF16415B5F6ED777EAFE695C49", 
            "data_model": "cayennelpp" 
        } 
    }, 
    "internalId": null, 
    "subscriptions": [] 
} | comp=IoTAgent 
time=2022-11-17T05:56:13.715Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Registration | from=n/a | srv=n/a | subsrv=n/a | msg=Registration with Context Provider is not needed. Device without lazy atts or commands | comp=IoTAgent 
time=2022-11-17T05:56:13.715Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=n/a | subsrv=n/a | msg=config.timestamp undefined true | comp=IoTAgent 
time=2022-11-17T05:56:13.717Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData: {"id":"loradev01","type":"LoraDevice","name":"urn:ngsi-ld:LoraDevice:loraent01","service":"Weather","subservice":"/","active":[{"object_id":"bp0","name":"barometric_pressure_0","type":"hpa"},{"object_id":"di3","name":"digital_in_3","type":"Number"},{"object_id":"do4","name":"digital_out_4","type":"Number"},{"object_id":"rh2","name":"relative_humidity_2","type":"Number"},{"object_id":"t1","name":"temperature_1","type":"Number"}],"staticAttributes":[],"lazy":null,"commands":[],"timezone":"America/Santiago","internalAttributes":{"lorawan":{"application_server":{"host":"mqtt.default.svc.cluster.local","username":"admin","password":"password","provider":"TTN"},"dev_eui":"1119343755556A14","app_eui":"4569343567897875","application_id":"demoTTN","application_key":"444B8EF16415B5F6ED777EAFE695C49","data_model":"cayennelpp"}},"internalId":null,"subscriptions":[]} | comp=IoTAgent 
time=2022-11-17T05:56:13.717Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=n/a | subsrv=n/a | msg=Creating initial entity in the Context Broker: 
 { 
    "url": "http://gateway.default.svc.cluster.local:9090/ngsi-ld/v1/entityOperations/upsert/", 
    "method": "POST", 
    "json": [ 
        { 
            "id": "urn:ngsi-ld:LoraDevice:loraent01", 
            "type": "LoraDevice" 
        } 
    ], 
    "headers": { 
        "fiware-service": "Weather", 
        "fiware-servicepath": "/", 
        "NGSILD-Tenant": "Weather", 
        "NGSILD-Path": "/", 
        "Content-Type": "application/ld+json" 
    } 
} | comp=IoTAgent 
time=2022-11-17T05:56:13.717Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.RestUtils | from=n/a | srv=n/a | subsrv=n/a | msg=executeWithSecurity | comp=IoTAgent 
time=2022-11-17T05:56:13.717Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {"type":"LoraDevice"} | comp=IoTAgent 
time=2022-11-17T05:56:13.721Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.MongoDBGroupRegister | from=n/a | srv=n/a | subsrv=n/a | msg=Device group for fields [["type"]] not found: [{"type":"LoraDevice"}] | comp=IoTAgent 
time=2022-11-17T05:56:13.721Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.RestUtils | from=n/a | srv=n/a | subsrv=n/a | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"type\"] and values: {\"type\":\"LoraDevice\"}","code":404} in get group device | comp=IoTAgent 
time=2022-11-17T05:56:13.722Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Options: { 
    "url": "http://gateway.default.svc.cluster.local:9090/ngsi-ld/v1/entityOperations/upsert/", 
    "method": "POST", 
    "json": [ 
        { 
            "id": "urn:ngsi-ld:LoraDevice:loraent01", 
            "type": "LoraDevice" 
        } 
    ], 
    "headers": { 
        "fiware-service": "Weather", 
        "fiware-servicepath": "/", 
        "NGSILD-Tenant": "Weather", 
        "NGSILD-Path": "/", 
        "Content-Type": "application/ld+json" 
    } 
} | comp=IoTAgent 
time=2022-11-17T05:56:14.075Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Response [ 
    { 
        "entityId": "urn:ngsi-ld:LoraDevice:loraent01", 
        "ProblemDetails": { 
            "type": "https://uri.etsi.org/ngsi-ld/errors/BadRequestData", 
            "status": "BAD_REQUEST", 
            "title": "Bad Request Data.", 
            "details": "@Context entry is needed" 
        } 
    } 
] | comp=IoTAgent 
time=2022-11-17T05:56:14.075Z | lvl=ERROR | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.Devices-LD | from=n/a | srv=n/a | subsrv=n/a | msg=Protocol error connecting to the Context Broker [400]: [ [Object] ] | comp=IoTAgent 
time=2022-11-17T05:56:14.078Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.DeviceProvisioning | from=n/a | srv=n/a | subsrv=n/a | msg=Device provisioning failed due to the following error:  | comp=IoTAgent Error accesing entity data for device: loradev01 of type: LoraDevice 
time=2022-11-17T05:56:14.079Z | lvl=DEBUG | corr=d0b61e71-16d9-4d2f-8dfb-80280020be26 | trans=d0b61e71-16d9-4d2f-8dfb-80280020be26 | op=IoTAgentNGSI.GenericMiddlewares | from=n/a | srv=n/a | subsrv=n/a | msg=Error [ENTITY_GENERIC_ERROR] handling request: Error accesing entity data for device: loradev01 of type: LoraDevice | comp=IoTAgent 
time=2022-11-17T05:56:14.082Z | lvl=DEBUG | corr=9f1269c3-bf83-4630-a599-e36d77989b21 | trans=9f1269c3-bf83-4630-a599-e36d77989b21 | op=IoTAgentNGSI.DomainControl | from=172.30.80.220 | srv=Weather | subsrv=/ | msg=response-time: 581 | comp=IoTAgent 

Affected Product Version:

fiware/iotagent-lorawan:1.2.3 &
ioeari/iotagent-lora:1.2.5

Environment details (with versions):

OS: Centos 7
Env (Docker/K8s): Both Docker & K8S

@jason-fox
Copy link
Contributor

The error message from your Scorpio broker is clear:

{
  "entityId": "urn:ngsi-ld:LoraDevice:loraent01",
  "ProblemDetails": {
    "type": "https://uri.etsi.org/ngsi-ld/errors/BadRequestData",
    "status": "BAD_REQUEST",
    "title": "Bad Request Data.",
    "details": "@Context entry is needed"
  }
}

The payload you are sending claims to be JSON-LD ("Content-Type": "application/ld+json") but no @context element is present. This is probably due to not setting the IOTA_JSON_LD_CONTEXT Docker Environment variable (or alternatively placing an jsonLdContext attribute in your config.js. You can see a working example in this docker-compose obviously IOTA_JSON_LD_CONTEXT should point to an accessible JSON-LD @context appropriate for your use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants