pytest fixtures and builders for ONAP VES 7.x events (fault, heartbeat, measurement, and more).
Project description
pytest-ves
pytest fixtures and builders for ONAP VES 7.x events.
Generate ready-to-use VES (Virtual Event Streaming, ONAP DCAE) event payloads in
Python tests — with sensible defaults, strong typing, and optional JSON Schema
validation against the official ONAP CommonEventFormat_30.2.1_ONAP.json.
Status: v0.1.0 in development. APIs may shift until 1.0.
Why
Testing O-RAN SMO / Non-RT RIC / rApp / VES Collector code in Python currently
requires either hand-writing VES JSON (error-prone, drifts with spec updates),
spinning up a Docker container (onap/integration-simulators-nf-simulator-ves-client)
just to emit a single event, or bridging through Robot Framework. This plugin
lets you write:
def test_fault_handler(ves_fault_event):
event = ves_fault_event(
source_name="nrCellDU=1",
alarm_condition="28",
event_severity="CRITICAL",
)
result = my_handler(event)
assert result.is_active
No container, no HTTP round-trip, no schema drift. The output is a plain
dict that validates against the official ONAP CommonEventFormat schema.
Install
Once the first release lands on PyPI:
pip install pytest-ves # core only
pip install "pytest-ves[fast]" # + jsonschema-rs (10-100x faster)
pip install "pytest-ves[factories]" # + polyfactory (random / fuzz data)
Pre-PyPI interim (this project has not yet published its first release): install directly from the git repo:
pip install "pytest-ves @ git+https://github.com/thc1006/pytest-ves.git@main"
# optional extras are honoured the same way:
pip install "pytest-ves[fast] @ git+https://github.com/thc1006/pytest-ves.git@main"
Or clone and install editable for local development:
git clone https://github.com/thc1006/pytest-ves.git
cd pytest-ves
uv sync --all-extras # or: pip install -e ".[fast,factories]"
Quickstart
import pytest
from pytest_ves import validate_ves
def test_fault_event_shape(ves_fault_event):
event = ves_fault_event(source_name="gNB-1", alarm_condition="28")
validate_ves(event) # raises jsonschema.ValidationError on failure
assert event["event"]["commonEventHeader"]["domain"] == "fault"
@pytest.mark.parametrize("severity", ["CRITICAL", "MAJOR", "MINOR"])
def test_severity_branches(ves_fault_event, severity):
event = ves_fault_event(event_severity=severity)
...
Supported VES versions
Single vendored schema (CommonEventFormat_30.2.1_ONAP.json) covers
7.0 / 7.0.1 / 7.1 / 7.1.1 / 7.2 / 7.2.1. Builders emit 7.2.1 defaults.
Fixture catalogue
Shipped
| Fixture | Domain | Since |
|---|---|---|
ves_fault_event |
fault | 0.1.0 |
ves_heartbeat_event |
heartbeat | 0.1.0 |
ves_measurement_event |
measurement | 0.1.0 |
ves_notification_event |
notification | 0.2.0 |
ves_pnf_registration_event |
pnfRegistration | 0.2.0 |
ves_stnd_defined_event |
stndDefined (envelope only -- see ADR-002) | 0.2.0 |
ves_syslog_event |
syslog | 0.2.0 |
ves_state_change_event |
stateChange | 0.2.0 |
ves_other_event |
other | 0.2.0 |
Roadmap (NOT shipped, DO NOT import)
Planned for v0.3.0 once their nested sub-object / array-of-object shapes
are modelled carefully. Attempting to use these right now will raise
fixture '<name>' not found.
| Fixture | Domain | Complexity |
|---|---|---|
ves_threshold_crossing_alert_event |
thresholdCrossingAlert | additionalParameters array-of-object |
ves_mobile_flow_event |
mobileFlow | nested gtpPerFlowMetrics object |
ves_sip_signaling_event |
sipSignaling | nested vendorNfNameFields |
ves_voice_quality_event |
voiceQuality | nested vendorNfNameFields + array |
ves_perf_3gpp_event |
perf3gpp | 3GPP-specific nested counters |
See docs/adr/ for design rationale. See CHANGELOG.md for release history.
Related projects
o-ran-smo-ves-dashboards(sister project, TBD) — Grafana dashboard pack for VES events stored in InfluxDB vianonrtric-plt-influxlogger. Usespytest-vesas its test-data seeder.o-ran-sc/smo-ves— upstream reference stack (VES Collector + Grafana + InfluxDB) used in our integration tests.onap/integration-simulators-nf-simulator-ves-client— upstream Java/Docker simulator; complementary tool, different use case.
License
Apache-2.0 for pytest-ves source. The vendored CommonEventFormat_30.2.1_ONAP.json
is Apache-2.0 © AT&T Intellectual Property (2020), Nokia Solutions and Networks
(2021). See NOTICE.
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 pytest_ves-0.2.2.tar.gz.
File metadata
- Download URL: pytest_ves-0.2.2.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd868223ba4f15d8ac0a026c1591107222aeb942643d313395a80d82935451e4
|
|
| MD5 |
10f0795c5875fb21b83cb2dcd7f2703d
|
|
| BLAKE2b-256 |
22fb84868f03162bc6473f0702dfc02737302e49036a707bcb42b92b9f730412
|
Provenance
The following attestation bundles were made for pytest_ves-0.2.2.tar.gz:
Publisher:
publish.yml on thc1006/pytest-ves
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_ves-0.2.2.tar.gz -
Subject digest:
dd868223ba4f15d8ac0a026c1591107222aeb942643d313395a80d82935451e4 - Sigstore transparency entry: 1339875478
- Sigstore integration time:
-
Permalink:
thc1006/pytest-ves@a8402c800ef0d45c2215706938d1bd6e547d00f0 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/thc1006
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8402c800ef0d45c2215706938d1bd6e547d00f0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_ves-0.2.2-py3-none-any.whl.
File metadata
- Download URL: pytest_ves-0.2.2-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86826ba647f8d906571eb80ac44d407352b3da45212017a634b9d321f965eb9d
|
|
| MD5 |
d476a474d62603669fba72f026473a18
|
|
| BLAKE2b-256 |
9c0e93a46aa5cc9efdff3cbf05389de5d0100fb77cb5c33845039677db0a024d
|
Provenance
The following attestation bundles were made for pytest_ves-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on thc1006/pytest-ves
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_ves-0.2.2-py3-none-any.whl -
Subject digest:
86826ba647f8d906571eb80ac44d407352b3da45212017a634b9d321f965eb9d - Sigstore transparency entry: 1339875481
- Sigstore integration time:
-
Permalink:
thc1006/pytest-ves@a8402c800ef0d45c2215706938d1bd6e547d00f0 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/thc1006
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8402c800ef0d45c2215706938d1bd6e547d00f0 -
Trigger Event:
release
-
Statement type: