bbfmodels 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bbfmodels-0.1.0/.github/workflows/ci.yml +41 -0
- bbfmodels-0.1.0/.github/workflows/docs.yml +50 -0
- bbfmodels-0.1.0/.github/workflows/pr-title.yml +23 -0
- bbfmodels-0.1.0/.github/workflows/publish.yml +63 -0
- bbfmodels-0.1.0/.github/workflows/release-please.yml +42 -0
- bbfmodels-0.1.0/.gitignore +23 -0
- bbfmodels-0.1.0/.python-version +1 -0
- bbfmodels-0.1.0/.release-please-manifest.json +3 -0
- bbfmodels-0.1.0/CHANGELOG.md +9 -0
- bbfmodels-0.1.0/CLAUDE.md +53 -0
- bbfmodels-0.1.0/CONTRIBUTING.md +32 -0
- bbfmodels-0.1.0/LICENSE +201 -0
- bbfmodels-0.1.0/Makefile +26 -0
- bbfmodels-0.1.0/NOTICE +2 -0
- bbfmodels-0.1.0/PKG-INFO +79 -0
- bbfmodels-0.1.0/README.md +54 -0
- bbfmodels-0.1.0/context/README.md +22 -0
- bbfmodels-0.1.0/context/decisions/0001-one-parser-one-ir-several-emitters.md +34 -0
- bbfmodels-0.1.0/context/decisions/0002-names-stay-as-the-forum-wrote-them.md +32 -0
- bbfmodels-0.1.0/context/decisions/0003-parse-the-flattened-full-documents.md +32 -0
- bbfmodels-0.1.0/context/decisions/0004-generated-output-is-committed.md +26 -0
- bbfmodels-0.1.0/context/decisions/0005-python-models-are-pydantic.md +27 -0
- bbfmodels-0.1.0/context/decisions/0006-everything-optional-unknown-paths-kept.md +26 -0
- bbfmodels-0.1.0/context/decisions/0007-vendor-extensions-are-overlays.md +25 -0
- bbfmodels-0.1.0/context/decisions/0008-python-toolchain.md +27 -0
- bbfmodels-0.1.0/context/decisions/0009-the-tree-keeps-wire-text.md +33 -0
- bbfmodels-0.1.0/docs/assets/images/ispx-icon.png +0 -0
- bbfmodels-0.1.0/docs/assets/js/copy-code.js +66 -0
- bbfmodels-0.1.0/docs/assets/js/powered-by.js +54 -0
- bbfmodels-0.1.0/docs/assets/stylesheets/extra.css +403 -0
- bbfmodels-0.1.0/docs/changelog.md +1 -0
- bbfmodels-0.1.0/docs/guides/quickstart.md +127 -0
- bbfmodels-0.1.0/docs/index.md +51 -0
- bbfmodels-0.1.0/hooks/changelog.py +67 -0
- bbfmodels-0.1.0/hooks/test_changelog.py +99 -0
- bbfmodels-0.1.0/mkdocs.yml +51 -0
- bbfmodels-0.1.0/pyproject.toml +63 -0
- bbfmodels-0.1.0/release-notes/0.1.0.md +9 -0
- bbfmodels-0.1.0/release-please-config.json +63 -0
- bbfmodels-0.1.0/requirements.txt +1 -0
- bbfmodels-0.1.0/scripts/bootstrap.sh +21 -0
- bbfmodels-0.1.0/src/bbfmodels/__init__.py +16 -0
- bbfmodels-0.1.0/src/bbfmodels/cli.py +79 -0
- bbfmodels-0.1.0/src/bbfmodels/codec.py +232 -0
- bbfmodels-0.1.0/src/bbfmodels/ir.py +327 -0
- bbfmodels-0.1.0/src/bbfmodels/parser.py +533 -0
- bbfmodels-0.1.0/src/bbfmodels/py.typed +0 -0
- bbfmodels-0.1.0/src/bbfmodels/schema.py +152 -0
- bbfmodels-0.1.0/src/bbfmodels/sources.py +79 -0
- bbfmodels-0.1.0/src/bbfmodels/tree.py +200 -0
- bbfmodels-0.1.0/tests/fixtures/mini-cwmp-full.xml +160 -0
- bbfmodels-0.1.0/tests/fixtures/mini-usp-full.xml +40 -0
- bbfmodels-0.1.0/tests/test_cli.py +44 -0
- bbfmodels-0.1.0/tests/test_codec.py +136 -0
- bbfmodels-0.1.0/tests/test_documents.py +104 -0
- bbfmodels-0.1.0/tests/test_parser.py +171 -0
- bbfmodels-0.1.0/tests/test_schema.py +80 -0
- bbfmodels-0.1.0/tests/test_tree.py +112 -0
- bbfmodels-0.1.0/uv.lock +558 -0
- bbfmodels-0.1.0/wrangler.jsonc +10 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
checks:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python: ["3.11", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: astral-sh/setup-uv@v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python }}
|
|
22
|
+
enable-cache: true
|
|
23
|
+
- name: Install
|
|
24
|
+
run: uv sync --frozen --group dev
|
|
25
|
+
- name: Cache the published documents
|
|
26
|
+
uses: actions/cache@v4
|
|
27
|
+
with:
|
|
28
|
+
path: ~/.cache/bbfmodels
|
|
29
|
+
key: bbf-documents-${{ hashFiles('src/bbfmodels/sources.py') }}
|
|
30
|
+
- name: Fetch the published documents
|
|
31
|
+
run: uv run bbfmodels fetch
|
|
32
|
+
- name: Format
|
|
33
|
+
run: uv run ruff format --check .
|
|
34
|
+
- name: Lint
|
|
35
|
+
run: uv run ruff check .
|
|
36
|
+
- name: Types
|
|
37
|
+
run: uv run mypy
|
|
38
|
+
- name: Test
|
|
39
|
+
run: uv run pytest -q
|
|
40
|
+
- name: Build
|
|
41
|
+
run: uv build
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
# Build check only: deployment is handled by the docs host's git integration
|
|
4
|
+
# watching main, so this repo carries no deploy configuration or secrets.
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
paths:
|
|
8
|
+
- "docs/**"
|
|
9
|
+
- "hooks/**"
|
|
10
|
+
- "CHANGELOG.md"
|
|
11
|
+
- "release-notes/**"
|
|
12
|
+
- "mkdocs.yml"
|
|
13
|
+
- "requirements.txt"
|
|
14
|
+
- ".github/workflows/docs.yml"
|
|
15
|
+
push:
|
|
16
|
+
branches: [main]
|
|
17
|
+
paths:
|
|
18
|
+
- "docs/**"
|
|
19
|
+
- "hooks/**"
|
|
20
|
+
- "CHANGELOG.md"
|
|
21
|
+
- "release-notes/**"
|
|
22
|
+
- "mkdocs.yml"
|
|
23
|
+
- "requirements.txt"
|
|
24
|
+
- ".github/workflows/docs.yml"
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
build:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- name: Checkout
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- name: Set up Python
|
|
37
|
+
uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
cache: pip
|
|
41
|
+
cache-dependency-path: requirements.txt
|
|
42
|
+
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: pip install -r requirements.txt
|
|
45
|
+
|
|
46
|
+
- name: Test the changelog hook
|
|
47
|
+
run: python -m unittest discover -s hooks
|
|
48
|
+
|
|
49
|
+
- name: Build site
|
|
50
|
+
run: mkdocs build --strict
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: pr-title
|
|
2
|
+
|
|
3
|
+
# PRs squash-merge, so the PR title becomes the commit subject that the
|
|
4
|
+
# changelog and the version bump are computed from.
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened, edited, reopened, synchronize]
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: "Title reads type(area): summary"
|
|
16
|
+
env:
|
|
17
|
+
TITLE: ${{ github.event.pull_request.title }}
|
|
18
|
+
run: |
|
|
19
|
+
pattern='^(feat|fix|perf|revert|docs|refactor|test|build|ci|chore|style)(\([a-z0-9][a-z0-9._/, +-]*\))?!?: [^ ].*$'
|
|
20
|
+
if ! printf '%s\n' "$TITLE" | grep -Eq "$pattern"; then
|
|
21
|
+
echo "::error::PR title must read type(area): summary, for example fix(api): reject cross-tenant lookups. Types: feat fix perf revert docs refactor test build ci chore style."
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# Runs on the vX.Y.Z tag that merging the Release PR creates. Builds the
|
|
4
|
+
# wheel and sdist, attaches them to the GitHub release, and publishes to
|
|
5
|
+
# PyPI through trusted publishing: PyPI trusts this repository's workflow
|
|
6
|
+
# by name and environment, so no token is stored anywhere.
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: astral-sh/setup-uv@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
- name: Install
|
|
25
|
+
run: uv sync --frozen --group dev
|
|
26
|
+
- name: Cache the published documents
|
|
27
|
+
uses: actions/cache@v4
|
|
28
|
+
with:
|
|
29
|
+
path: ~/.cache/bbfmodels
|
|
30
|
+
key: bbf-documents-${{ hashFiles('src/bbfmodels/sources.py') }}
|
|
31
|
+
- name: Fetch the published documents
|
|
32
|
+
run: uv run bbfmodels fetch
|
|
33
|
+
- name: Test
|
|
34
|
+
run: uv run pytest -q
|
|
35
|
+
- name: The package version is the tag
|
|
36
|
+
run: |
|
|
37
|
+
version=$(uv run python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
|
|
38
|
+
test "$version" = "${GITHUB_REF_NAME#v}" || { echo "pyproject.toml says $version, tag is $GITHUB_REF_NAME"; exit 1; }
|
|
39
|
+
- name: Build
|
|
40
|
+
run: uv build
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
- name: Attach to the GitHub release
|
|
46
|
+
env:
|
|
47
|
+
GH_TOKEN: ${{ github.token }}
|
|
48
|
+
run: gh release upload "$GITHUB_REF_NAME" dist/* --clobber
|
|
49
|
+
|
|
50
|
+
publish:
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
url: https://pypi.org/project/bbfmodels/
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/download-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: dist
|
|
62
|
+
path: dist/
|
|
63
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: release-please
|
|
2
|
+
|
|
3
|
+
# Keeps one Release PR open against main with the next version and the
|
|
4
|
+
# changelog entry built from the commits since the last tag. Merging that PR
|
|
5
|
+
# creates the vX.Y.Z tag and the GitHub Release; workflows that publish or
|
|
6
|
+
# deploy trigger on the tag. Tags pushed with the default GITHUB_TOKEN start
|
|
7
|
+
# no workflows, which is why the step below mints a GitHub App token when the
|
|
8
|
+
# repo has one configured.
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
branches: [main]
|
|
12
|
+
workflow_dispatch: {} # refresh the Release PR after a commit override
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
pull-requests: write
|
|
17
|
+
issues: write
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: release-please
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
release:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Mint release token
|
|
28
|
+
id: app
|
|
29
|
+
if: vars.RELEASE_APP_ID != ''
|
|
30
|
+
uses: actions/create-github-app-token@v2
|
|
31
|
+
with:
|
|
32
|
+
app-id: ${{ vars.RELEASE_APP_ID }}
|
|
33
|
+
private-key: ${{ secrets.RELEASE_APP_KEY }}
|
|
34
|
+
|
|
35
|
+
- name: Warn when no release token is configured
|
|
36
|
+
if: vars.RELEASE_APP_ID == ''
|
|
37
|
+
run: echo "::warning::RELEASE_APP_ID is not set. A tag created with the default token does not start the workflows that publish the release."
|
|
38
|
+
|
|
39
|
+
- name: Release Please
|
|
40
|
+
uses: googleapis/release-please-action@v5
|
|
41
|
+
with:
|
|
42
|
+
token: ${{ steps.app.outputs.token || github.token }}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.venv/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
|
|
12
|
+
# Docs build output
|
|
13
|
+
/site/
|
|
14
|
+
|
|
15
|
+
# Local scratch
|
|
16
|
+
.env
|
|
17
|
+
.worktrees/
|
|
18
|
+
|
|
19
|
+
# Editors and OS
|
|
20
|
+
.idea/
|
|
21
|
+
.vscode/
|
|
22
|
+
*.swp
|
|
23
|
+
.DS_Store
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
* **parser:** read a published document into the intermediate representation ([#1](https://github.com/ispx-limited/bbfmodels/issues/1)) ([462d045](https://github.com/ispx-limited/bbfmodels/commit/462d04530a7d3a7d62a3da440404f4afcadb2c4f))
|
|
9
|
+
* **runtime:** resolve paths, hold a device's values and validate them against the schema ([#3](https://github.com/ispx-limited/bbfmodels/issues/3)) ([35146ad](https://github.com/ispx-limited/bbfmodels/commit/35146adb52757ac9a05836415f87815135c55b94))
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# bbfmodels
|
|
2
|
+
|
|
3
|
+
Typed models and schema tooling for Broadband Forum data models, generated
|
|
4
|
+
from the XML the Forum publishes. The README says what it is for; this file
|
|
5
|
+
is for anyone, person or coding agent, working in the repository.
|
|
6
|
+
|
|
7
|
+
## Layout
|
|
8
|
+
|
|
9
|
+
- `context/` is the design memory: `context/decisions/` holds the
|
|
10
|
+
architecture decision records and `context/README.md` indexes them. Read
|
|
11
|
+
it before touching the parser, the IR or a generator, and add a record
|
|
12
|
+
when a change makes or reverses a significant decision.
|
|
13
|
+
- `src/bbfmodels/` is the package. `cli.py` is the command line entry point.
|
|
14
|
+
- `tests/` holds the pytest suite.
|
|
15
|
+
- `docs/` is the documentation site (mkdocs), built strictly in CI. A page
|
|
16
|
+
exists when it has content; nothing is scaffolded empty.
|
|
17
|
+
- `hooks/changelog.py` renders `CHANGELOG.md` and `release-notes/` as the
|
|
18
|
+
docs site's Changelog page. `CHANGELOG.md` is written by the release
|
|
19
|
+
automation and never edited by hand on `main`.
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
- Set up: `scripts/bootstrap.sh`
|
|
24
|
+
- Tests: `make test`
|
|
25
|
+
- Format, lint, types: `make lint`
|
|
26
|
+
- Docs: `make docs`
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- **The intermediate representation is the contract.** Everything downstream
|
|
31
|
+
of the parser reads the IR, never the XML. A new output language is an
|
|
32
|
+
emitter over the IR, not a second parser.
|
|
33
|
+
- **Generated output is committed and never hand-edited.** Change the
|
|
34
|
+
generator or the source document, regenerate, and commit the result. CI
|
|
35
|
+
fails when committed output is stale.
|
|
36
|
+
- **Names are the Forum's names.** Objects, parameters, commands and events
|
|
37
|
+
keep their PascalCase spelling verbatim. `{i}` stays in schema paths; data
|
|
38
|
+
paths carry instance numbers.
|
|
39
|
+
- **No vendor or product knowledge in code.** Vendor extensions come from
|
|
40
|
+
the vendor's own TR-106 document and generate overlays. No lookup tables
|
|
41
|
+
of OUIs, model names or firmware versions.
|
|
42
|
+
- **Everything optional, unknown paths kept.** A real device exposes a
|
|
43
|
+
subset of the model plus parameters the model does not know. A tree
|
|
44
|
+
built from device values keeps what it did not recognise and writes it
|
|
45
|
+
back unchanged.
|
|
46
|
+
- **Python is written for Python.** ruff formats and lints, mypy runs
|
|
47
|
+
strict, pytest tests behaviour rather than implementation. New logic
|
|
48
|
+
ships with tests in the same change.
|
|
49
|
+
- **Writing style**, in code comments, docs and commit messages: plain
|
|
50
|
+
words, short sentences, no em dashes, no emoji. Comments state what the
|
|
51
|
+
code cannot: a constraint, a reason, a reference to the specification.
|
|
52
|
+
- Commits and PR titles read `type(area): imperative summary`. One change
|
|
53
|
+
per PR, squash merged.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Bug reports, corrections against the published models and code are welcome.
|
|
4
|
+
Vendor extension documents in the TR-106 schema are especially welcome once
|
|
5
|
+
the parser lands, because the tool is only as useful as the range of real
|
|
6
|
+
device models it can read.
|
|
7
|
+
|
|
8
|
+
## Building and testing
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
scripts/bootstrap.sh # installs the pinned Python and dependencies with uv
|
|
12
|
+
make test
|
|
13
|
+
make lint # format check, lint and type check, what CI runs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Conventions
|
|
17
|
+
|
|
18
|
+
- Commits and PR titles read `type(area): imperative summary`, for example
|
|
19
|
+
`fix(parser): a list facet with no item type is a list of strings`. CI
|
|
20
|
+
rejects any other title.
|
|
21
|
+
- One change per PR. PRs are squash merged, so the title is the commit.
|
|
22
|
+
- Generated files are never edited by hand. Change the generator or the
|
|
23
|
+
source document and regenerate; CI fails when committed output is stale.
|
|
24
|
+
- Attribute and class names keep the Forum's PascalCase verbatim.
|
|
25
|
+
- The tool carries no knowledge of any vendor or product. Vendor behaviour
|
|
26
|
+
comes from a vendor's own data model document, never from code.
|
|
27
|
+
|
|
28
|
+
## Releases
|
|
29
|
+
|
|
30
|
+
Merging the Release PR that release automation keeps open creates the
|
|
31
|
+
version tag. The tag publishes the package to PyPI and attaches the wheel
|
|
32
|
+
and sdist to the GitHub release. Nothing is tagged or uploaded by hand.
|
bbfmodels-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
bbfmodels-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.DEFAULT_GOAL := help
|
|
2
|
+
.PHONY: help build test lint run docs clean
|
|
3
|
+
|
|
4
|
+
help: ## List available targets
|
|
5
|
+
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z_-]+:.*## / {printf "%-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
6
|
+
|
|
7
|
+
build: ## Build the wheel and sdist into dist/
|
|
8
|
+
uv build
|
|
9
|
+
|
|
10
|
+
test: ## Run the test suite
|
|
11
|
+
uv run pytest -q
|
|
12
|
+
|
|
13
|
+
lint: ## Format check, lint and type check, the same commands CI runs
|
|
14
|
+
uv run ruff format --check .
|
|
15
|
+
uv run ruff check .
|
|
16
|
+
uv run mypy
|
|
17
|
+
|
|
18
|
+
run: ## Run the command line tool
|
|
19
|
+
uv run bbfmodels
|
|
20
|
+
|
|
21
|
+
docs: ## Build the documentation site strictly
|
|
22
|
+
uv run --with-requirements requirements.txt --no-project python -m unittest discover -s hooks
|
|
23
|
+
uv run --with-requirements requirements.txt --no-project mkdocs build --strict
|
|
24
|
+
|
|
25
|
+
clean: ## Remove build artifacts
|
|
26
|
+
rm -rf dist build site .venv .pytest_cache .mypy_cache .ruff_cache
|
bbfmodels-0.1.0/NOTICE
ADDED
bbfmodels-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bbfmodels
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed models and schema tooling for Broadband Forum data models (TR-181, TR-098, TR-104 and more), generated from the published XML
|
|
5
|
+
Project-URL: Homepage, https://github.com/ispx-limited/bbfmodels
|
|
6
|
+
Project-URL: Documentation, https://docs.bbfmodels.ispx.co/
|
|
7
|
+
Project-URL: Changelog, https://docs.bbfmodels.ispx.co/changelog/
|
|
8
|
+
Author: ISPX LIMITED
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: broadband-forum,cwmp,data-model,tr-069,tr-098,tr-181,tr-369,usp
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: System :: Networking
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: pydantic>=2.14
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# bbfmodels
|
|
27
|
+
|
|
28
|
+
Typed models and schema tooling for Broadband Forum data models (TR-181,
|
|
29
|
+
TR-098, TR-104 and the rest), generated from the XML the Forum publishes.
|
|
30
|
+
|
|
31
|
+
The Forum defines what a broadband gateway exposes to its management system
|
|
32
|
+
as XML in the TR-106 schema: thousands of objects and parameters, their types,
|
|
33
|
+
ranges, enumerations, writability and multi-instance tables. Everyone who
|
|
34
|
+
builds against those models, an ACS, a USP controller, a device simulator, an
|
|
35
|
+
integration script, re-derives the same facts from the same XML and hand-types
|
|
36
|
+
the same parameter paths as strings. bbfmodels does it once:
|
|
37
|
+
|
|
38
|
+
- A parser that reads the published XML into a normalised intermediate
|
|
39
|
+
representation, published as JSON with its own schema.
|
|
40
|
+
- A Python runtime that works from that representation: resolve a path,
|
|
41
|
+
validate a value against the model's constraints, convert between the flat
|
|
42
|
+
path and value lists that CWMP and USP carry on the wire and a typed tree.
|
|
43
|
+
- Generated typed bindings: pydantic models for Python first, JSON Schema and
|
|
44
|
+
TypeScript from the same representation, Go when there is a consumer.
|
|
45
|
+
|
|
46
|
+
Names stay as the Forum wrote them. `Device.WiFi.SSID.{i}.SSID` is a table of
|
|
47
|
+
`SSID` entries indexed by instance number, and the attribute is `SSID`, not
|
|
48
|
+
`ssid`.
|
|
49
|
+
|
|
50
|
+
## Status
|
|
51
|
+
|
|
52
|
+
Pre-release. The parser, the intermediate representation and the runtime
|
|
53
|
+
are in place: `bbfmodels fetch` downloads the Forum's published documents,
|
|
54
|
+
`bbfmodels ir` turns one into JSON, and the `Schema` and `Tree` classes
|
|
55
|
+
resolve paths, hold a device's values and validate them. Generated Python
|
|
56
|
+
models come next. Until the first release there is no package on PyPI.
|
|
57
|
+
|
|
58
|
+
The design decisions behind the code are in `context/decisions/`, indexed in
|
|
59
|
+
`context/README.md`. Read them before changing the parser or the IR.
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
Prerequisites: git and [uv](https://docs.astral.sh/uv/). The pinned Python is
|
|
64
|
+
installed by uv.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
scripts/bootstrap.sh
|
|
68
|
+
make test
|
|
69
|
+
make lint
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`make help` lists the rest. Documentation is built from `docs/` with
|
|
73
|
+
`make docs` and published at https://docs.bbfmodels.ispx.co/.
|
|
74
|
+
|
|
75
|
+
## Licence
|
|
76
|
+
|
|
77
|
+
Apache-2.0, copyright ISPX LIMITED. The Broadband Forum publishes its data
|
|
78
|
+
models under the BSD 3-clause licence; output derived from them carries the
|
|
79
|
+
Forum's notice.
|