openits-models

module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0

README

openits-models

The OpenITS data-model layer: vendor-neutral model definitions and the code generated from them, published as a standalone Go module. Components such as collectors consume it as a dependency.

Module path: github.com/Vikasa2M/openits-models

Layout

Path Contents
yang/ YANG source modules (the source of truth for the model).
api/proto/ Protobuf sources: hand-authored command.proto/device.proto plus generated per-service protos under openits/<service>/v1/ (events.proto, state.proto, types.proto, and per-event JSON Schemas), produced from yang/ by the in-repo YANG→proto generator (tools/yang-proto-gen).
pkg/proto/openits/<service>/v1/ Generated Go protobuf types per service (e.g. package dmsv1); pkg/proto/openits/v1/ holds only the command/device types (package openitspb).
pkg/yang/openits/ Generated ygot Go types (package openits).
schema-registry/ AsyncAPI/JSON-schema registry entries per service.
bindings/nats/ NATS reference profile: subject grammar, CloudEvents envelope, JetStream notes (README.md) and the generated asyncapi.yaml (see note below). The transport-neutral model layer above does not depend on it.
scripts/, tools/ Model generation, validation, and lint tooling.
docs/ Design rationale — how the model is shaped and why.

Design & rationale

The model's shape is deliberate, and much of it is a direct application of OpenConfig's lessons: many small, independently-versioned modules rather than a mega-module per device; leaning into the telemetry side that OpenConfig got right; and avoiding the one-size-fits-all configuration side that fractured. See:

Using it

go get github.com/Vikasa2M/openits-models@latest
import (
    openitspb "github.com/Vikasa2M/openits-models/pkg/proto/openits/v1"     // command / device
    dmsv1     "github.com/Vikasa2M/openits-models/pkg/proto/openits/dms/v1" // one service's events + state
    openits   "github.com/Vikasa2M/openits-models/pkg/yang/openits"
)

Non-Go implementers should start from the curated release bundle instead (yang/, api/proto/, schema-registry/, bindings/ — attached to each GitHub release).

Regeneration

make gen             # all of the below: proto, Go, AsyncAPI and the ce-type catalog
make yang-proto-gen  # yang -> api/proto/openits/<service>/v1/*.proto + field-numbers.yaml lock
make proto           # api/proto -> pkg/proto (protoc)
make yang            # yang -> pkg/yang (ygot fakeroot structs)
make asyncapi        # yang -> bindings/nats/asyncapi.yaml
make catalog         # yang -> schema-registry/index.json (ce-type catalog)
./scripts/update-schema-registry.sh  # snapshot changed modules into schema-registry/
make check-gen       # gen, then fail if output drifts from what's committed (freshness gate)
make ci              # the full local gate, mirroring CI (run on a committed tree)

command.proto/device.proto under api/proto/ are hand-curated and untouched by make yang-proto-gen.

Requires protoc/buf, ygot/goyang, and (optionally) pyang and yanglint.

bindings/nats/asyncapi.yaml is carried here as a published artifact of the NATS reference profile, regenerated in-repo from the YANG-derived ce-type catalog by make asyncapi. See bindings/nats/README.md for the profile spec and docs/07-conformance.md for the two-tier (model vs. NATS-profile) conformance model.

Provenance

openits-models is self-contained: the YANG modules are the source of truth, and every other artifact (protobuf, Go, JSON Schema, AsyncAPI, schema-registry snapshots) is generated from them by in-repo tooling. No other repository is required to build, generate, or validate this repo. The collector and other consumers depend on this module; this module depends on none of them.

Contributing, versioning & releases

  • CONTRIBUTING.md — the edit-YANG-then-regenerate workflow and the full set of gates CI enforces.
  • docs/versioning.md — how the Go module version, per-module YANG revisions, and protobuf wire compatibility relate, plus the step-by-step release process.
  • CHANGELOG.md — notable changes per release.

CI (.github/workflows/ci.yml) runs the gate on every pull request as grouped jobs — go (generation freshness, go build/vet/test), buf (lint + breaking-change detection), yang (governance checks, yang-lint, yanglint instance-data validation) and conformance (every device kind) — after a changes job classifies the diff. The required check ci-ok rolls them up. A docs-only PR skips go, buf and conformance but still runs yang; the release-please PR skips every gate; a push to main runs only the go job's build, vet and test steps.

License

Licensed under the Apache License 2.0. See NOTICE for attribution, including the vendored IETF YANG modules under yang/ietf/.

Directories

Path Synopsis
internal
wireshape
Package wireshape renders the wire shape of protobuf messages: a canonical, diffable text of every message and enum a set of root messages can put on the wire, as compiled.
Package wireshape renders the wire shape of protobuf messages: a canonical, diffable text of every message and enum a set of root messages can put on the wire, as compiled.
pkg
yang/openits
Package openits is a generated package which contains definitions of structs which represent a YANG schema.
Package openits is a generated package which contains definitions of structs which represent a YANG schema.
tools
arcit-coverage command
Command arcit-coverage scans openits YANG modules for `arc-it-flow` annotations and emits a Markdown report diffing them against an ARC-IT inventory.
Command arcit-coverage scans openits YANG modules for `arc-it-flow` annotations and emits a Markdown report diffing them against an ARC-IT inventory.
check-augment-collisions command
check-augment-collisions fails when two augments target the same YANG node.
check-augment-collisions fails when two augments target the same YANG node.
check-ce-id-vectors command
check-ce-id-vectors re-derives every published ce-id test vector in docs/ce-id-spec.md straight from the algorithm that document specifies, and fails if any of them disagrees.
check-ce-id-vectors re-derives every published ce-id test vector in docs/ce-id-spec.md straight from the algorithm that document specifies, and fails if any of them disagrees.
check-conventions command
check-conventions lints OpenITS YANG modules against the mechanical conventions of the pre-1.0 house contract (rule 6 in docs/reference/yang-reference-conventions.md) and compares the result with a checked-in, shrink-only exceptions file.
check-conventions lints OpenITS YANG modules against the mechanical conventions of the pre-1.0 house contract (rule 6 in docs/reference/yang-reference-conventions.md) and compares the result with a checked-in, shrink-only exceptions file.
check-deviations command
check-deviations validates yang/deviations/*.yang modules: each deviation must RESOLVE against the base openits YANG modules, and it may only TIGHTEN the base contract — never loosen it.
check-deviations validates yang/deviations/*.yang modules: each deviation must RESOLVE against the base openits YANG modules, and it may only TIGHTEN the base contract — never loosen it.
check-events-layering command
check-events-layering enforces the events-module layering rule: every yang/*-events.yang module may import only
check-events-layering enforces the events-module layering rule: every yang/*-events.yang module may import only
check-graduation command
check-graduation reports per-augment NoI counts, independent-org counts, operator presence, and graduation eligibility.
check-graduation reports per-augment NoI counts, independent-org counts, operator presence, and graduation eligibility.
check-mode-kinds command
check-mode-kinds binds each family's mode-changed kind to that family's mode vocabulary.
check-mode-kinds binds each family's mode-changed kind to that family's mode vocabulary.
check-revision-history command
check-revision-history fails when a change edits or deletes a YANG revision statement that already exists on the base branch, or edits, deletes or adds to a schema-registry snapshot that already exists there (see registry.go).
check-revision-history fails when a change edits or deletes a YANG revision statement that already exists on the base branch, or edits, deletes or adds to a schema-registry snapshot that already exists there (see registry.go).
conformance command
Command conformance runs the OpenITS conformance suite against a device under test.
Command conformance runs the OpenITS conformance suite against a device under test.
conformance/tests
Package tests contains the OpenITS conformance test functions.
Package tests contains the OpenITS conformance test functions.
noi-validator command
noi-validator walks schema-registry/notices/ and validates every NoI YAML against schema-registry/notices/_schema/noi-schema.yaml — the single source of truth.
noi-validator walks schema-registry/notices/ and validates every NoI YAML against schema-registry/notices/_schema/noi-schema.yaml — the single source of truth.
openits-new-service command
openits-new-service scaffolds the boilerplate-heavy files for a new service package.
openits-new-service scaffolds the boilerplate-heavy files for a new service package.
yang-proto-gen command
Command yang-proto-gen generates protobuf definitions from the openits YANG modules using goyang.
Command yang-proto-gen generates protobuf definitions from the openits YANG modules using goyang.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL