Search code examples
fiwarefiware-orion

IoTAgent unable to send notification to Orion CB


I can confirm my LwM2M client is sending observation to the IoTAgent, I can also see the IoTAgent trying to forward observed measure to Orion CB, but failed with following log:

time=2019-02-26T13:34:47.877Z | lvl=DEBUG | corr=n/a | trans=n/a | op=LWM2MLib.Registration | msg=Registration request ended successfully
time=2019-02-26T13:34:47.927Z | lvl=DEBUG | corr=n/a | trans=n/a | op=LWM2MLib.InformationReporting | msg=Observing value from resource /3303/0/5700 in device [1]
time=2019-02-26T13:34:47.947Z | lvl=ERROR | corr=519dbe74-0142-48b7-8290-444f86df5053 | trans=519dbe74-0142-48b7-8290-444f86df5053 | op=IoTAgentNGSI.DomainControl | srv=n/a | subsrv=n/a | msg=Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:34:47.948Z | lvl=DEBUG | corr=519dbe74-0142-48b7-8290-444f86df5053 | trans=519dbe74-0142-48b7-8290-444f86df5053 | op=IoTAgentNGSI.DomainControl | srv=n/a | subsrv=n/a | msg=response-time: 79406 | comp=IoTAgent
time=2019-02-26T13:35:02.965Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:35:17.981Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:35:48.012Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:36:03.030Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:36:23.059Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent
time=2019-02-26T13:36:53.086Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: No matching format found | comp=IoTAgent

Below is what the Orion CB reports in its log:

time=Tuesday 26 Feb 13:34:47 2019.838Z | lvl=INFO | corr=48de7b18-39cb-11e9-8c5b-0242ac1b0006 | trans=1551188006-596-00000000004 | from=172.27.0.5 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1916]:lmTransactionEnd | msg=Transaction ended
time=Tuesday 26 Feb 13:35:28 2019.446Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=connectionOperations.cpp[701]:runCollectionCommand | msg=Database Operation Successful (command: { listDatabases: 1 })
time=Tuesday 26 Feb 13:35:28 2019.447Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=connectionOperations.cpp[94]:collectionQuery | msg=Database Operation Successful (query: {})
time=Tuesday 26 Feb 13:35:28 2019.447Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=connectionOperations.cpp[94]:collectionQuery | msg=Database Operation Successful (query: {})
time=Tuesday 26 Feb 13:36:28 2019.450Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=connectionOperations.cpp[701]:runCollectionCommand | msg=Database Operation Successful (command: { listDatabases: 1 })

Any idea why this error, what is causing it?


Solution

  • Figure out the problem. A mismatch between client-agent data encode (TLV and JSON).

    Changed the encode style in the client wakaama/core/liblwm2m.h to match that of IoTAgent. ..wakaama/core/liblwm2m.h:

        LWM2M_CONTENT_TEXT      = 0,        // Also used as undefined
        LWM2M_CONTENT_LINK      = 40,
        LWM2M_CONTENT_OPAQUE    = 42,
        LWM2M_CONTENT_TLV_OLD   = 1542,     // Keep old value for backward-compatibility
        LWM2M_CONTENT_TLV       = 11542,
        LWM2M_CONTENT_JSON_OLD  = 1543,     // Keep old value for backward-compatibility
        LWM2M_CONTENT_JSON      = 11543
        LWM2M_CONTENT_TLV_OLD   = 11542,     // Keep old value for backward-compatibility
        LWM2M_CONTENT_TLV       = 1542,
        LWM2M_CONTENT_JSON_OLD  = 11543,     // Keep old value for backward-compatibility
        LWM2M_CONTENT_JSON      = 1543
    } lwm2m_media_type_t;
    

    Matching the IoTAgent config.js configuration file:

    delayedObservationTimeout: 50,
        formats: [
            {
                name: 'application-vnd-oma-lwm2m/text',
                value: 1541
            },
            {
                name: 'application-vnd-oma-lwm2m/tlv',
                value: 1542
            },
            {
                name: 'application-vnd-oma-lwm2m/json',
                value: 1543
            },
            {
                name: 'application-vnd-oma-lwm2m/opaque',
                value: 1544
            }
        ],
        writeFormat: 'application-vnd-oma-lwm2m/text',
        types: [ ]
    };
    

    Now working...