Skip to main content

platform_tools

Test-center platform tooling for ZPILOT ECUs. The repository is a monorepo whose centerpiece is someip-py — a Python implementation of SOME/IP (Scalable service-Oriented MiddlewarE over IP) used to encode/decode, capture, simulate and test SOME/IP services over TCP/UDP on the bench and in the vehicle.

The core library is packaged as someip-py and exposes a single facade class, SOMEIPService, plus a someip command-line tool.

  • SOME/IP-PY — the framework (this document's main subject)
  • someip_gui — a PySide6 ADUserSettingService simulator built on top of the library
  • tests — pytest unit tests and HMI/bench scene tests
  • tools — standalone helpers (CAN adapters, PTP, image/CV, radar, PDU, topics)

Repository layout

platform_tools/
├── someip_py/                  # SOME/IP core library (installable: someip-py)
│   ├── interface.py            # SOMEIPService facade, Platform enum, code generation
│   ├── frame.py                # SOME/IP header + Service Discovery frames
│   ├── codec.py                # AUTOSAR payload (de)serialization primitives
│   ├── client.py               # SOMEIPClient (find, subscribe, R&R, F&F, fields)
│   ├── server.py               # SOMEIPServer (offer, subscribe-ack, notify, methods)
│   ├── config.py               # SD matching dataclasses (Eventgroup, SDService)
│   ├── e2e.py                  # AUTOSAR E2E Profile 11
│   ├── scapy_extention.py      # scapy layers for pcap dissection
│   ├── constants.py            # message/return-code/entry-type enums, SD tuning
│   ├── utils.py                # logging, protoc wrapper, imports, JSON encoder
│   ├── secure_upload.py        # AES-obfuscated twine upload helper
│   ├── cli.py                  # `someip` Click CLI
│   └── service_interface/      # service matrix + per-platform generated code
│       ├── config.json         # master service matrix (platform → service → interface)
│       ├── protoc/             # bundled protoc for Windows/Linux
│       └── p_{2x,30t,l946,smart,eea}/   # generated payload classes + pb/
├── someip_gui/                 # PySide6 ADUserSettingService simulator (companion app)
├── tests/                      # pytest unit tests + tests/hmi + tests/mcu
├── tools/                      # gcan / zlg / zqwl / ptp / image / pdu / radar / topic
├── setup.cfg, setup.py, MANIFEST.in
├── tox.ini, .pre-commit-config.yaml
└── obfuscate.sh

SOME/IP-PY

Features

  • Framing — encode/decode the 16-byte SOME/IP header and payload.
  • Service Discovery — full SD frame/entry/option (de)serialization (Find/Offer/Subscribe/SubscribeAck).
  • Payload codec — AUTOSAR primitive datatypes, fixed/dynamic-size arrays and strings, composed into SomeIpPayload classes.
  • protobuf support — per-platform *_pb2.py modules with isolated descriptor pools so multiple platforms can coexist in one process.
  • Client / Server — request-response, fire-and-forget, event subscription (notification), and field getter/setter.
  • pcap analysis — iterate or export decoded SOME/IP traffic from a capture file.
  • E2E Profile 11 — AUTOSAR end-to-end CRC header, interoperable with the target ECU.
  • Service generation — generate SomeIpPayload subclasses from a communication matrix (arxml/xlsx) via a bundled Jinja2 template.

Installation

pip install click jinja2 openpyxl pandas "protobuf>=3.18.0,<=3.20.3" scapy
pip install -e .

This installs the someip console command (someip = someip_py.cli:main).

Core concepts

Platform. A someip_py instance is scoped to one vehicle platform. The available platforms are string constants on SOMEIPService.Platform:

Constant Value Notes
P_2X p_2x default
P_30T p_30t
P_L946 p_l946
P_Smart p_smart codec-only, no pb/
P_EEA p_eea

Service matrix. someip_py/service_interface/config.json is the master matrix: it maps each platform to the services and interfaces the library knows about. It is loaded lazily by _init_services and drives view, describe, encode_payload, decode_payload, as_client and as_server.

Generated payload classes. Under each service_interface/<platform>/<Service>/ directory live the generated SomeIpPayload subclasses (e.g. ADCURequest.py). They are produced from the matrix by the Jinja2 template in interface.py and imported on demand.

protobuf. Services that carry protobuf payloads have a service_interface/<platform>/pb/Adcu/*_pb2.py directory. Each platform is imported into its own descriptor_pool.DescriptorPool() (see _import_pb), so services with identical message names across platforms do not collide.

Regenerating protobuf from .proto. Pass proto_path to the constructor; utils.convert_proto wipes and recreates the platform's pb/ directory and runs the bundled protoc:

from someip_py import SOMEIPService

svc = SOMEIPService(
    platform=SOMEIPService.Platform.P_30T,
    proto_path="/path/to/protos",   # directory containing *.proto
)

utils.get_protoc() selects service_interface/protoc/{windows,linux}/bin/protoc for the current OS. The repository ships no .proto sources of its own — supply your own proto_path.

Module reference

Module Responsibility
interface.py SOMEIPService facade, Platform, exception types, code generation, pcap parsing.
frame.py SOMEIPFrame (16-byte header), SD entry/option/header/frame types.
codec.py AUTOSAR datatypes (Uint8..64, Int8..64, Bool, Float32/64), arrays, strings, SomeIpPayload, serialize.
config.py SD-matching dataclasses Eventgroup and SDService.
constants.py SOMEIPMessageType, SOMEIPTPMessageType, SOMEIPReturnCode, SOMEIPSDEntryType, SD timing values, multicast address/port.
server.py SOMEIPServer, Service, SimpleEventgroup.
client.py SOMEIPClient (context manager).
e2e.py E2E Profile 11 CRC/header helpers.
scapy_extention.py scapy layers SOMEIP, SOMEIP_SD, patched CustomUDP/CustomTCP.
utils.py set_logger, get_protoc, convert_proto, import_class, JsonEncoderWrapper, hex2int, str2bool, type2bytes.
cli.py Click CLI (someip).

Quick start — encode / decode a payload

from someip_py import SOMEIPService

svc = SOMEIPService(platform=SOMEIPService.Platform.P_30T)

# structures mirror the generated payload class fields
payload = svc.encode_payload(
    0x200D,
    0x9005,
    message_type=2,          # SOMEIPMessageType.NOTIFICATION
    structures={
        "IdtOTAStatus": [
            {"ActionName": 1, "ActionStatus": False},
            {"ActionName": 2, "ActionStatus": False},
        ]
    },
)
print(payload.hex())

# decode back into a JSON-able structure
print(svc.decode_payload(0x200D, 0x9005, message_type=2, payload=payload))

view(service_id, method_id, message_type=...) prints a decoded payload, and describe(service, interface, message_type=...) returns a JSON schema tree — both are handy for building UIs on top of the library.

Client / server

SOMEIPService can run as a server (offer a service and answer requests/notify events) or as a client (find, subscribe and call):

from someip_py import SOMEIPService

svc = SOMEIPService(platform=SOMEIPService.Platform.P_30T)

# --- server ---
server = svc.as_server(
    service="ADADCUService",
    interfaces=["ADCURequest"],
    local_bind_address="10.206.0.1",
    mcast_address="227.100.206.1",
    mcast_port=30490,
)
# set the payload the server answers with / notifies, then pull requests
svc.update_response(server, "ADADCUService", "ADCURequest", structures={...})
svc.update_notification(server, "ADADCUService", "ADCURequest", structures={...})
req = svc.get_request(server, timeout=0.5)     # decoded SOMEIPFrame or None
server.close()

# --- client ---
frame = svc.as_client(
    service="ADADCUService",
    interface="ADCURequest",
    remote_address="10.206.0.5",
    remote_port=54001,
    local_address="10.206.0.1",
    mcast_address="227.100.206.1",
    timeout=5.0,
)

as_client dispatches on the interface type: a method interface runs a request-response call, an event interface subscribes for notifications, and a field interface uses typ ("sub", "getter" or "setter") to pick the accessor. Pass loop_time=<seconds> to run the call repeatedly on a daemon thread — in that mode as_client returns None instead of a frame.

The lower-level SOMEIPServer.register_service accepts a dict service template (the authoritative example lives in its docstring):

server.register_service({
    "service_id": "0x405f",
    "instance_id": 1,
    "major_version": 6,
    "minor_version": 0,
    "tcp_port": 54001,
    "udp_port": 54001,
    "interface": [
        {"type": "method", "protocol": "tcp", "method_id": "0x001", "structures": {}},
        {"type": "event", "protocol": "udp", "method_id": "0x002",
         "eventgroup_id": 1, "structures": {}},
        {"type": "field", "protocol": "udp", "method_id": "0x002",
         "eventgroup_id": 1, "getter_id": "0x003", "setter_id": "0x004",
         "structures": {}},
    ],
})

At the lowest level, SOMEIPClient exposes find_service, subscribe, rr_method (request-response), ff_method (fire-and-forget), field_getter and field_setter.

pcap analysis

svc = SOMEIPService(platform=SOMEIPService.Platform.P_30T)

for pkt in svc.iter_pcap("capture.pcap", filters={"service_id": "0x1005"}):
    print(pkt)

svc.parse_pcap("capture.pcap", output="./out", filters={"service_id": "0x1005"})

iter_pcap patches scapy's payload-guessing only for the duration of the read and restores it afterwards, so it is safe to call alongside other scapy users.

E2E Profile 11

e2e.py implements AUTOSAR E2E Profile 11 for SOME/IP: a 2-byte header placed between the 16-byte SOME/IP header and the payload.

  • byte 0: CRC8 (polynomial 0x1D, init 0x00, no final XOR)
  • byte 1: high nibble = bits 11..8 of the 16-bit Data ID, low nibble = 4-bit counter (0..14)

Enable it per frame with the e2e=True / data_id=<id> flags on SOMEIPFrame and the e2e / data_id arguments of as_client, update_response and update_notification. Helpers: calc_crc8, counter_byte, profile11_header, profile11_check.

CLI reference

The someip command is a Click group:

Command Purpose Key options
someip gen Generate service modules from a communication matrix -p/--platform, -f/--file (matrix, required), -o/--output (default services)
someip decode Decode a payload to JSON -s/--service_id, -m/--method_id, -t/--message_type (default 2), -d/--data, -i/--idl, -P/--proto_path
someip parse Parse a pcap file -f/--file (required), -o/--output, -s/--service_id, -m/--method_id, -i/--idl, -P/--proto_path
someip sub Subscribe to an event/interface as a client -s/--service, -i/--interface, -r/--remote_address, -l/--local_address, -m/--mcast_address, -t/--timeout, -T/--ttl
someip inject Apply a JSON config to the service matrix -f/--file (JSON, required), -p/--platform, -i/--idl, -P/--proto_path
someip server start Start a simulation server -s/--service, -i/--interface, -l/--local_address, -m/--mcast_address, -p/--port, -t/--timeout
someip server stop Reserved (currently a no-op stub) -p/--platform

Example:

someip decode -p p_30t -s 0x200d -m 0x9005 -t 2 -d 0001...ff
someip parse  -p p_30t -f capture.pcap -o ./out -s 0x1005
someip sub    -p p_30t -s ADADCUService -i ADCURequest -r 10.206.0.5

Logging

Use utils.set_logger(name="someip", console=True, persistence=True, path=...) to attach a console handler and/or a rotating file handler under <path>/logs/<name>/<timestamp>/.


someip_gui

A PySide6 desktop simulator for the DHU-side ADUserSettingService (python -m someip_gui). It lists every setting key (1–86) with its known name, lets you set Value, and pushes the result as a ADUserSettingSts notification plus GetAllParameters / GetIntParameters responses. It can also SSH into the board, run ros2 topic echo /hmi/hmi_setting, and show the live topic value next to each setting so you can verify the downlink end to end.

  • Platforms: p_30t, p_l946, p_eea (shared service definition).
  • Service port comes from service_interface/config.json (TCP 54001); the SD multicast address/port are editable in the toolbar.
  • Notification interval defaults to 200 ms so edits reach the board without waiting for a resubscribe; set it to 0 to send only on subscribe.
  • SSH defaults: 10.205.0.5:22, nvidia/nvidia, topic /hmi/hmi_setting.
  • Requires PySide6 and paramiko (neither is in install_requires).
  • Setting names come from tests/hmi/*/test_ADUserSettingService.py; keys the tests leave unnamed are shown as key_XX and are still settable.
  • Each key has an enable checkbox; disabled keys are omitted from both the notification and the getter responses (their values are not sent at all).

Tests

Tests use pytest (pinned to 7.4.4 in tox.ini).

  • tests/*.py — unit tests for payload encode/decode, code generation, arxml parsing, encryption and pcap+protobuf decoding (2.pcap fixture included).
  • tests/hmi/ — per-platform (2x/30t/eea/l946/smart) bench scene tests that talk to the ECU over SSH (sshutils.SSHClient) and, in some scenes, ROS (rclpy). Scene cases are named test_ZZ*.py.
  • tests/mcu/ — MCU-side service tests.
pytest tests
# or, fully isolated, across supported interpreters:
tox                # py37/py38/py39/py310 + lint + typing

Some tests require bench access (SSH/ROS) and are not runnable in CI.


tools

Standalone utilities, each self-contained:

  • gcan/, zlg/, zqwl/ — CAN/CAN-FD adapter drivers.
  • ptp/ — PTP (IEEE 1588) master/layer helpers.
  • image/ — zkr_cv, an OpenCV-based keypoint/template-matching package.
  • pdu/ — PDU control.
  • radar/ — radar message parser.
  • topic/ — topic-list generators.
  • crc32p4_autosar.py — AUTOSAR CRC32P4.
  • xlsx_to_someip_json.py — convert an xlsx matrix to the JSON service config.

Development

Formatting / linting are enforced by pre-commit:

Tool Version Notes
isort 5.11.5 --profile black
black 22.3.0 pinned to python3.11 (22.3.0 breaks on 3.12+)
flake8 5.0.4 max-line-length = 120 (see tox.ini)
pip install pre-commit && pre-commit run --all-files

tox.ini also defines lint (pre-commit), typing (mypy --ignore-missing-imports someip_py) and release environments.

Release. Build a wheel and upload it to the internal PyPI:

python setup.py bdist_wheel
twine upload dist/*

secure_upload.py (secureupload entry point) wraps twine with an AES-obfuscated credential flow for automated publishing. obfuscate.sh copies someip_py to x_obfuscate and runs pyminify over every module except service_interface/, for shipping a minified build.


Dependencies and compatibility

  • Python: >=3.7 (classifiers advertise 3.7–3.12; tox exercises 3.7–3.10).
  • Runtime: click, jinja2, openpyxl, pandas, protobuf>=3.18.0,<=3.20.3, scapy, setuptools.
  • Extra (not declared in install_requires): lxml (arxml tests), pycryptodome + twine (secure upload / release), PySide6 + paramiko (someip_gui).

Authors

Package author/maintainer: weidong.huang (see setup.cfg).

Contributing

Clone and branch from master:

git clone https://gitlab.ql-drive.com/zpilot/zcloud/test_center/test_case_center/platform_tools.git
cd platform_tools
git checkout -b feat/<topic>

Run pre-commit run --all-files and tox before opening a merge request.

Metadata

Release files for someip-py 0.1.7

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

Built distribution (wheel)

Table of built distributions (wheels) for someip-py 0.1.7
File Interpreter ABI Platform Actions
someip_py-0.1.7-py2.py3-none-any.whl Python 3, Python 2 none any Details for someip_py-0.1.7-py2.py3-none-any.whl

Release files / someip_py-0.1.7-py2.py3-none-any.whl

Download URL someip_py-0.1.7-py2.py3-none-any.whl
Size 5.6 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e4ed1b8a67e2944d43ba8b6c0110eaad208f031f0a4bd4d7610e900220005a5a
BLAKE2b-256 checksum
How to use checksums
22d071fe8ca0699b18e425865758bcb66ecf7c39ed1f9ff3bcd3c87694763859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for someip-py 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.7 This release

1 release file No provenance

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