Convert OpenSCHC JSON rule files into CORECONF/CBOR .sor files
Project description
rule2sor
Convert OpenSCHC JSON rule files into
.sor files (the Set of Rules serialized in CORECONF/CBOR, following the
ietf-schc YANG data model).
Usage with uvx
uvx --from git+https://github.com/ltn22/rule2sor rule2sor <rule-file.json>
Or after installation (pip install git+https://github.com/ltn22/rule2sor):
rule2sor <rule-file.json> [-s <sid-file>] [-o <output.sor>] [-q]
By default the output file has the same name as the input with the .sor
extension, and the SID file is the bundled ietf-schc@2026-05-07.sid.
With -q only the final message is printed.
If you pass a .sor file instead of a JSON file, rule2sor will read and print
its contents (CBOR hex, CBOR diagnostic notation, and decoded RESTCONF JSON)
directly to the standard output:
rule2sor <file.sor> [-s <sid-file>]
Example:
rule2sor atmos41.json
# -> atmos41.sor
rule2sor atmos41.sor
# displays the content of atmos41.sor
What it does
This is an extraction of the minimal code from OpenSCHC:
gen_rulemanager.py— trimmedRuleManagerkeeping:Add(): loads a JSON rule file, checks rule integrity (RuleID overlaps, valid FID/MO/CDA, one of compression/fragmentation/no-compression per rule) and fills in missing defaults (FL, FP, DI);Print(): displays the rules as ASCII tables;add_sid_file()/to_coreconf(): serializes the Set of Rules in CORECONF/CBOR using the SID values.
gen_parameters.py— constants,YANG_IDmapping (simplified to a direct name-to-YANG-identifier mapping) andadapt_value().ietf-schc@2026-05-07.sid— default SID file.
JSON rule format
See the long docstring at the top of rule2sor/gen_rulemanager.py, which
documents the OpenSCHC JSON rule data model (compression and fragmentation).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rule2sor-0.1.0.tar.gz.
File metadata
- Download URL: rule2sor-0.1.0.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be0805c985b5dbbfa08a61ffb720dff5f92d281ddb136d5c657381c65b015626
|
|
| MD5 |
646ddc06b173da9ced9e6e95b62349cb
|
|
| BLAKE2b-256 |
9b67605b2093f646ec0067eb6de6a7db58c83782f8cc2bdb1c0edf4e94830cd8
|
File details
Details for the file rule2sor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rule2sor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8893b4cd5d9f2008cc6a8eb484ff241d84631f5e224ab1b861fc104f6e3631d7
|
|
| MD5 |
3e7fb99d54b450cc7c397a0880d30286
|
|
| BLAKE2b-256 |
05ada8ad6d0a211580aba0945a5977b8fd7657f8b4597a13a21b2bf58f774496
|