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

SENML_JSON unable to decode #1651

Closed
itayYaakov opened this issue Sep 26, 2024 · 3 comments
Closed

SENML_JSON unable to decode #1651

itayYaakov opened this issue Sep 26, 2024 · 3 comments
Labels
bug Dysfunctionnal behavior

Comments

@itayYaakov
Copy link

Version(s)

2229014

Which components

LWM2M Server Demo

Tested With

2229014

What happened

Hi,
We're testing SENML reading with /16/0/0, and with senml format and using leshan server demo we now recevice:
"Invalid Response: Unable to decode response payload of request [ReadRequest [path=/16/0/0 format=SENML_JSON(110)]] from client [test_ue]"

We think it may be related to changes performed:
ec57648

Leshan Request and our device Response are attached.
Any help will be appreciated, Thanks!

How to reproduce

Read operation on /16/0/0 with SENML JSON format

Relevant Output

Request:
Frame 155: 101 bytes on wire (808 bits), 101 bytes captured (808 bits) on interface -, id 0
EXPORTED_PDU
Internet Protocol Version 4, Src: ???, Dst: ???
User Datagram Protocol, Src Port: 5683, Dst Port: ???
Constrained Application Protocol, Confirmable, GET, MID:33406
01.. .... = Version: 1
..00 .... = Type: Confirmable (0)
.... 1000 = Token Length: 8
Code: GET (1)
Message ID: 33406
Token: 7c40ae0fb43991d0
Opt Name: #1: Uri-Path: 16
Opt Desc: Type 11, Critical, Unsafe
1011 .... = Opt Delta: 11
.... 0010 = Opt Length: 2
Uri-Path: 16
Opt Name: #2: Uri-Path: 0
Opt Desc: Type 11, Critical, Unsafe
0000 .... = Opt Delta: 0
.... 0001 = Opt Length: 1
Uri-Path: 0
Opt Name: #3: Uri-Path: 0
Opt Desc: Type 11, Critical, Unsafe
0000 .... = Opt Delta: 0
.... 0001 = Opt Length: 1
Uri-Path: 0
Opt Name: #4: Accept: application/senml+json
Opt Desc: Type 17, Critical, Safe
0110 .... = Opt Delta: 6
.... 0001 = Opt Length: 1
Accept: application/senml+json
[Uri-Path: /16/0/0]
[Response In: 156]

Hex dump:
0000 48 01 82 7e 7c 40 ae 0f b4 39 91 d0 b2 31 36 01 H..~|@...9...16.
0010 30 01 30 61 6e 0.0an`

Response:
Frame 156: 207 bytes on wire (1656 bits), 207 bytes captured (1656 bits) on interface -, id 0
EXPORTED_PDU
Internet Protocol Version 4, Src: ???, Dst: ???
User Datagram Protocol, Src Port: ???, Dst Port: 5683
Constrained Application Protocol, Acknowledgement, 2.05 Content, MID:33406
01.. .... = Version: 1
..10 .... = Type: Acknowledgement (2)
.... 1000 = Token Length: 8
Code: 2.05 Content (69)
Message ID: 33406
Token: 7c40ae0fb43991d0
Opt Name: #1: Content-Format: application/senml+json
Opt Desc: Type 12, Elective, Safe
1100 .... = Opt Delta: 12
.... 0001 = Opt Length: 1
Content-type: application/senml+json
End of options marker: 255
Payload: Payload Content-Format: application/senml+json, Length: 112
[Uri-Path: /16/0/0]
[Request In: 155]
[Response Time: 0.003019000 seconds]
JavaScript Object Notation: application/senml+json
Array
Object
Member: bn
[Path with value: /[]/bn:/16/0/0/]
[Member with value: bn:/16/0/0/]
String value: /16/0/0/
Key: bn
[Path: /[]/bn]
Member: n
[Path with value: /[]/n:3/]
[Member with value: n:3/]
String value: 3/
Key: n
[Path: /[]/n]
Member: vs
[Path with value: /[]/vs:HSW0]
[Member with value: vs:HSW0]
String value: HSW0
Key: vs
[Path: /[]/vs]
Object
Member: n
[Path with value: /[]/n:2/]
[Member with value: n:2/]
String value: 2/
Key: n
[Path: /[]/n]
Member: vs
[Path with value: /[]/vs:HMOD0]
[Member with value: vs:HMOD0]
String value: HMOD0
Key: vs
[Path: /[]/vs]
Object
Member: n
[Path with value: /[]/n:1/]
[Member with value: n:1/]
String value: 1/
Key: n
[Path: /[]/n]
Member: vs
[Path with value: /[]/vs:HMAN0]
[Member with value: vs:HMAN0]
String value: HMAN0
Key: vs
[Path: /[]/vs]
Object
Member: n
[Path with value: /[]/n:0/]
[Member with value: n:0/]
String value: 0/
Key: n
[Path: /[]/n]
Member: vs
[Path with value: /[]/vs:HUID0]
[Member with value: vs:HUID0]
String value: HUID0
Key: vs
[Path: /[]/vs]

Hex dump:
0000 5b 7b 22 62 6e 22 3a 22 2f 31 36 2f 30 2f 30 2f [{"bn":"/16/0/0/
0010 22 2c 22 6e 22 3a 22 33 2f 22 2c 22 76 73 22 3a ","n":"3/","vs":
0020 22 48 53 57 30 22 7d 2c 7b 22 6e 22 3a 22 32 2f "HSW0"},{"n":"2/
0030 22 2c 22 76 73 22 3a 22 48 4d 4f 44 30 22 7d 2c ","vs":"HMOD0"},
0040 7b 22 6e 22 3a 22 31 2f 22 2c 22 76 73 22 3a 22 {"n":"1/","vs":"
0050 48 4d 41 4e 30 22 7d 2c 7b 22 6e 22 3a 22 30 2f HMAN0"},{"n":"0/
0060 22 2c 22 76 73 22 3a 22 48 55 49 44 30 22 7d 5d ","vs":"HUID0"}]

Ascii Output:
[{"bn":"/16/0/0/","n":"3/","vs":"HSW0"},{"n":"2/","vs":"HMOD0"},{"n":"1/","vs":"HMAN0"},{"n":"0/","vs":"HUID0"}]

@itayYaakov itayYaakov added the bug Dysfunctionnal behavior label Sep 26, 2024
@sbernard31
Copy link
Contributor

sbernard31 commented Sep 26, 2024

@itayYaakov at first sight, I guess this is because your path ends with /.
bn and n should be concatenated to create the LWM2M path.

In your case :

[
  {
    "bn": "/16/0/0/",
    "n": "3/",
    "vs": "HSW0"
  },
  {
    "n": "2/",
    "vs": "HMOD0"
  },
  {
    "n": "1/",
    "vs": "HMAN0"
  },
  {
    "n": "0/",
    "vs": "HUID0"
  }
]

will lead to :

  • "bn":"/16/0/0/" + "n":"3/" ==> /16/0/0/3/
  • "bn":"/16/0/0/" + "n":"2/" ==> /16/0/0/2/
  • "bn":"/16/0/0/" + "n":"1/" ==> /16/0/0/1/
  • "bn":"/16/0/0/" + "n":"0/" ==> /16/0/0/0/

but AFAIK, your path should not ends with / and so should be :

  • "bn":"/16/0/0/" + "n":"3" ==> /16/0/0/3
  • "bn":"/16/0/0/" + "n":"2" ==> /16/0/0/2
  • "bn":"/16/0/0/" + "n":"1" ==> /16/0/0/1
  • "bn":"/16/0/0/" + "n":"0" ==> /16/0/0/0

Before Leshan tolerate that "bad behavior", with new LWM2M parser it doesn't tolerate it anymore.

See : https://www.openmobilealliance.org/release/LightweightM2M/V1_1_1-20190617-A/HTML-Version/OMA-TS-LightweightM2M_Core-V1_1_1-20190617-A.html#7-4-5-0-745-SenML-JSON

@sbernard31
Copy link
Contributor

Let me know if this answers to your question and if I should close the issue.

@itayYaakov
Copy link
Author

Hi @sbernard31, thank you for the details explanation!
We would check ot throughly.
I will close the issue

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

No branches or pull requests

2 participants