This repository contains a kotlin based domain specific language (dsl) to quickly and intuitively write custom DoIP ECU simulations.
Its main purpose is to enable programmers to quickly write integration tests for DoIP clients, and therefore to allow better testing of error and edge cases, as well as creating regression tests.
To see a fairly comprehensive example with explanations on how to use this library in a project, look at the example project doip-sim-ecu-dsl-example.
There's another example of how a DoIP ECU UDS simulation could be used in a test setup (e.g. with additional REST interface).
The doip-library & DSL is written in Kotlin/JVM with the ktor-network library.
An ecu-simulation that utilizes this library will therefore require usage of compatible versions of these dependencies.
For build.gradle.kts:
repositories {
...
mavenCentral()
...
}
dependencies {
...
implementation("io.github.doip-sim-ecu:doip-sim-ecu-dsl:<REPLACE_WITH_VERSION>")
...
}
For build.gradle:
repositories {
...
mavenCentral()
...
}
dependencies {
...
implementation 'io.github.doip-sim-ecu:doip-sim-ecu-dsl:<REPLACE_WITH_VERSION>'
...
}
See MyCustomGateway.kt in the example project for a detailed description of the syntax & semantics.
Essentially:
gateway("NAME") {
logicalAddress = 0x1010
...
// Request-Handling for the Gateway
request("11 03") { ack() }
...
ecu("ECU") {
physicalAddress = 0x1011
...
// Request-Handling for the (non-doip)-ECU behind the gateway
request("11 03") { ack() }
}
}
Call start()
in your main-method, which will register the DoIP-Entities on the configured
network-interfaces and sent out Vehicle-Announcement-Messages.
The simulation will now respond to UDP and TCP-Requests on their configured ports (Default: 13400), and handle incoming messages/requests.
In an earlier version this library utilized the doip-simulation project for the DoIP-stack. The stack has since been replaced by a custom kotlin implementation, whose concepts still bear some resemblance to its predecessor.
This software is licensed under the Apache-2.0 license.
See LICENSE.txt for details.