RFC 8428 Sensor Measurement Lists (SenML) defines a format for representing simple sensor measurements and device parameters in Sensor Measurement Lists.
Disco SenML is a fork of cisco/senml that resolves various issues. Programs are smaller, CBOR representation no longer violates RFC 8428, and all unit tests pass.
By switching CBOR library to fxamacker/cbor, x448/senml is not vulnerable to the same resource exhaustion attacks as cisco/senml from malformed SenML CBOR representation.
By switching CBOR library to fxamacker/cbor, x448/senml is 4.4 MB smaller than cisco/senml (for senmlCat).
All features are the same as cisco/senml except MessagePack support is removed.
Disco SenML was created on Nov 23, 2019 using cisco/senml (4d43ea8) dated Oct 10, 2019.
Special thanks:
- Cullen Jennings for his work on RFC 8428 (SenML) and cisco/senml. He did the heavy lifting in those, so changes made by this project are trivial by comparison.
- Faye Amacker for adding requested features to her CBOR library that made this easy.
Disco SenML initial release on Nov 24, 2019.
This project fixes open issues in cisco/senml (d5a3c66, Dec 11, 2019):
- cisco/senml #2 (2016) "CBOR does not encode or decode numeric field names". <-- RFC 8428 violation.
- cisco/senml #18 (2017) "Base Value and Base Sum missing from the model.
- cisco/senml #22 (2019) "CBOR support uses go-codec which adds bloat to the binary.
- cisco/senml #25 (2019) "cisco/senml does not pass unit tests"
There are no changes to core cisco/senml features except removal of MessagePack.
MessagePack was removed because it:
- increased bloat (cisco/senml #22) and attack surface.
- isn't mentioned in SenML RFC 8428.
- prevented having a CBOR library (fxamacker/cbor) as the only external dependency.
Changes to cisco/senml (4d43ea8, Oct 10, 2019):
- Compiled programs are each 4 MB smaller (senmlCat and senmlServer).
- CBOR representation uses integers for labels, so it no longer violates SenML RFC 8428.
- Missing Base Value and Base Sum are added to the model.
- Fixed bad test data in unit tests and added new CBOR test using example from SenML RFC 8428 so all unit tests pass.
- Removed MessagePack feature for reasons cited in README.md.
- Replaced ugorji/go with fxamacker/cbor.
- Use Go modules and have at least one tagged release.
- Require Go 1.12
- Added name to LICENSE.
- Updated README.md with new name "Disco SenML"
Known limitations:
- There are no unit tests for senmlCat or senmlServer. Using senmlCat or senmlServer is not recommended.
- Security Audit: I didn't conduct a security audit of cisco/senml or this project. A security audit is recommended.
- Code Review and Refactoring: I didn't perform any code review or refactoring beyond the minimum changes required to resolve cisco/senml issues 2, 18, 22 and 25. Code review and refactoring is recommended.
Go 1.12+ is required.
Tool to convert SenML between formats and act as gateway server to other services
senmlCat -json -i data.json > data.xml
senmlCat.go -ijson -cbor data.json > data.cbor
senmlCat -expand -ijsons -csv -print data.json > foo.csv
Note that this moves times to excel times that are days since 1900
This listens on port 880 then writes to an influx instance at localhost where to the database called "junk"
The -expand is needed to expand base values into each line of the Line Protocol
senmlCat -ijsons -http 8880 -expand -linp -print -post http://localhost:8086/write?db=junk
Copyright © 2019-present Montgomery Edwards⁴⁴⁸ (github.com/x448)
Copyright © 2016-2019 Cullen Jennings
x448/senml is licensed under the BSD 2-Clause "Simplified" License. See LICENSE for the full license text.