Skip to main content

python-osism

Quay PyPi version PyPi license Documentation

Documentation

  • SONiC ConfigDB validation — how osism sonic validate is built, what it does not check, and the caveat that the vendored YANG models are a different SONiC flavour to the devices.

Running unit tests

Install development dependencies and run the full unit test suite:

pipenv install --dev
pipenv run pytest

Run a single test module:

pipenv run pytest tests/unit/test_smoke.py

Running integration tests

The integration tests in tests/integration/ exercise the Celery/Redis task core (broker, queue routing, worker, result backend, Redis streams and locks) end-to-end. They require a reachable Redis and start a Celery worker from the same virtualenv; they are skipped automatically when Redis is not running.

docker run -d -p 6379:6379 redis:7-alpine
REDIS_HOST=localhost REDIS_DB=15 pipenv run pytest tests/integration

Warning: The suite mutates live state on the configured Redis. Most keys are per-run (UUID-based), but some are fixed global names on the selected REDIS_DB: the task-lock test reads, writes and removes osism:task_lock, and the vault test removes ansible_vault_password — which a real deployment cannot recover, since no other copy of it exists on the system. Always point the suite at a disposable Redis (such as the throwaway container above).

To make that hard to get wrong, the suite refuses to run against REDIS_DB=0, the database a deployment uses. Set REDIS_DB to a spare database as shown above, or OSISM_ALLOW_DEFAULT_REDIS_DB=1 if the Redis itself is disposable. REDIS_DB moves the direct client, the Celery broker and the result backend together.

Running the SONiC E2E golden test

The end-to-end test in tests/e2e/ provisions NetBox with a docker compose stack, seeds it from the fixtures in tests/e2e/scenario/, generates the SONiC config_db.json files and compares them against the goldens in tests/e2e/golden/. Besides the development dependencies it needs docker with the compose plugin, openssl, and a netbox-manager checkout for the seeding CLI — a sibling directory by default, NETBOX_MANAGER_DIR otherwise.

pipenv install --dev
make sonic-e2e

A cold run takes roughly ten minutes, most of it starting NetBox. To iterate without paying that each time, bring the stack up separately and leave it running:

make sonic-e2e-up      # start NetBox and leave it up; sonic-e2e reuses it
make sonic-e2e-down    # stop it again and remove its volumes

After an intentional generator change, rewrite the goldens and review the diff before committing it. Regeneration deliberately refuses to run against a stack left over from an earlier run, because applying the fixtures over a populated database can produce goldens that CI — which always starts fresh — would not reproduce:

make sonic-e2e-down
make sonic-e2e-regen

How much of the generated config the golden set actually covers is reported separately, because nothing in CI reports it:

make sonic-e2e-coverage

That compares the config_db tables the generator can emit against the tables that are non-empty in at least one golden, and names any that no golden covers. It exits non-zero while that list is non-empty, so it is worth running after adding a scenario to confirm the new tables landed. It gates nothing on its own — the golden comparison above is the only check that fails a run.

tests/e2e/sonic_golden_test.sh documents the remaining environment overrides (NETBOX_PORT, KEEP_STACK, SEED_PARALLEL and the regeneration escape hatch).

Warning: Seeding applies every file under tests/e2e/scenario/resources/, tracked or not, so a stray file there joins the fixture set — which either breaks the run or silently changes the goldens. Check that directory with git status --ignored before regenerating or debugging a mismatch.

Metadata

Release files for osism 0.20260920.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osism 0.20260920.0
File Size Uploaded
osism-0.20260920.0.tar.gz 992.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for osism 0.20260920.0
File Interpreter ABI Platform
osism-0.20260920.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / osism-0.20260920.0.tar.gz

Download URL osism-0.20260920.0.tar.gz
Size 992.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b9cbc75378308afe3539a832f5de68e94b879372e8a2452c36212954fd4bd800
BLAKE2b-256 checksum
How to use checksums
f76fa1a0b03a4a0e34bdb29e742b6419700ff2a9c735adb839f03b6abf5eee5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / osism-0.20260920.0-py3-none-any.whl

Download URL osism-0.20260920.0-py3-none-any.whl
Size 307.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
765e5b2442c027deb7bafe087d7f4dee0c53455161ff94f289a19d81e00cf55c
BLAKE2b-256 checksum
How to use checksums
66dca5df71ec827c7230ed3a85e987fb7e6242773a5a82f9b478a5b0442e325e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.20260920.0 This release

2 release files

0.10.0

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page