The can_frame function within the mock-jutsu library is a specialised tool designed for automotive engineers and software developers who require high-fidelity mock data for vehicle network simulation. By adhering strictly to the ISO 11898-1 standard, this function generates realistic Controller Area Network frames that are indispensable for stress-testing electronic control units (ECUs) and diagnostic interfaces. Whether you are working with standard 11-bit identifiers or extended 29-bit IDs, the generator ensures that every field—from the Start of Frame to the Data Length Code—is mathematically consistent and ready for injection into virtualised environments.
A standout feature of the can_frame utility is its rigorous implementation of the CRC-15 integrity check. Using the 0xC599 polynomial, mock-jutsu calculates a precise checksum over the SOF, Identifier, Control, and Data fields, ensuring the test data mirrors the physical reality of a hardware bus. This level of detail allows developers to validate error-handling logic and frame filtering mechanisms without needing physical hardware. Furthermore, the output is formatted using standard SocketCAN notation, such as 1A2#DEADBEEF, making it immediately compatible with Linux-based utilities like candump and cansend for seamless integration into existing pipelines.
Integrating this function into your development workflow is straightforward, regardless of your preferred environment. For rapid prototyping, the mock-jutsu CLI offers an instant generation path, while the Python API allows for the programmatic creation of complex traffic patterns within automated test suites. Performance testers can also leverage the JMeter plugin to simulate heavy bus loads, ensuring that gateway modules can handle peak throughput. By providing reliable and structured test data, mock-jutsu significantly reduces the time spent on manual data entry and hardware setup, allowing teams to focus on core logic.
Ultimately, the can_frame function empowers engineering teams to shift-left their automotive testing strategies. By simulating edge cases—such as maximum payload DLCs or specific extended ID ranges—developers can identify potential firmware bugs early in the development lifecycle. Using mock-jutsu ensures that your simulation environment remains robust, scalable, and technically accurate, providing a cost-effective alternative to expensive physical test benches while maintaining the strict integrity required for safety-critical automotive software development.
mockjutsu generate can_framemockjutsu bulk can_frame --count 10mockjutsu export can_frame --count 10 --format jsonmockjutsu export can_frame --count 10 --format csvmockjutsu export can_frame --count 10 --format sqlfrom mockjutsu import jutsujutsu.generate('can_frame')jutsu.bulk('can_frame', count=10)jutsu.template(['can_frame'], count=5)${__mockjutsu_automotive(can_frame)}# JMeter Function: __mockjutsu_automotive# Parameter 1: can_frame# Parameter 2: (not required for this function)GET /generate/can_frame# → {"type":"can_frame","result":"...","status":"ok"}GET /bulk/can_frame?count=10POST /template {"types":["can_frame"],"count":1}