Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/x448/senml
Disco SenML is cisco/senml with bugfixes. Programs are 4 MB smaller and SenML CBOR complies with RFC 8428.
https://github.com/x448/senml
cbor go golang iot rfc-8428 senml
Last synced: 28 days ago
JSON representation
Disco SenML is cisco/senml with bugfixes. Programs are 4 MB smaller and SenML CBOR complies with RFC 8428.
- Host: GitHub
- URL: https://github.com/x448/senml
- Owner: x448
- License: bsd-2-clause
- Created: 2019-11-25T00:08:52.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-07T17:39:42.000Z (over 3 years ago)
- Last Synced: 2024-08-03T23:26:35.226Z (4 months ago)
- Topics: cbor, go, golang, iot, rfc-8428, senml
- Language: Go
- Homepage:
- Size: 81.1 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - senml
README
# Disco SenML is cisco/senml with bugfixes
[![](https://github.com/x448/senml/workflows/ci/badge.svg)](https://github.com/x448/senml/blob/master/.github/workflows/ci.yml)
[![cover ≥80.7%](https://github.com/x448/senml/workflows/cover%2080.7%25/badge.svg)](https://github.com/x448/senml/actions?query=workflow%3A%22cover+80.7%25%22)## SenML
[RFC 8428 Sensor Measurement Lists (SenML)](https://tools.ietf.org/html/rfc8428) defines a format for representing simple sensor measurements and device parameters in Sensor Measurement Lists.## Disco SenML
Disco SenML is a fork of [cisco/senml](https://github.com/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](https://github.com/fxamacker/cbor), x448/senml is not vulnerable to the same resource exhaustion attacks as cisco/senml from malformed SenML CBOR representation.
![image](https://user-images.githubusercontent.com/57072051/79265367-9e3ad180-7e5b-11ea-9ed0-d3779de8d72a.png)
By switching CBOR library to [fxamacker/cbor](https://github.com/fxamacker/cbor), x448/senml is 4.4 MB smaller than cisco/senml (for senmlCat).
![image](https://user-images.githubusercontent.com/57072051/79264086-99751e00-7e59-11ea-8c0f-a8bf0dfdf9ba.png)
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](https://github.com/fxamacker/cbor) that made this easy.## Release Notes
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](https://github.com/fxamacker/cbor) (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"## Limitations
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.## Requirements
Go 1.12+ is required.
# senmlCat
Tool to convert SenML between formats and act as gateway server to other services# usage
## convert JSON SenML to XML
senmlCat -json -i data.json > data.xml## convert JSON SenML to CBOR
senmlCat.go -ijson -cbor data.json > data.cbor## convert to Excel spreadsheet CSV file
senmlCat -expand -ijsons -csv -print data.json > foo.csvNote that this moves times to excel times that are days since 1900
## listen for posts of SenML in JSON and send to influxdb
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
# License
Copyright © 2019-present Montgomery Edwards⁴⁴⁸ (github.com/x448)
Copyright © 2016-2019 Cullen Jenningsx448/senml is licensed under the BSD 2-Clause "Simplified" License. See [LICENSE](LICENSE) for the full license text.