Giter Site home page Giter Site logo

iso15118-simulator-rs's Introduction

ISO15118 Simulator provides JSON/Rest-Websocket APIs to simulate an EV/EVSE

Provide a JSON Afb-V4 api to ISO15118-encoders. Each ISO message is exposed a Afb-V4 RPCs. In EV mode the simulator start sending an SDP discovery multi-cast message in IPV6 to configured interface and establishes a TCP/TLS connection to start ISO dialogue.

Dependencies

Compilation

    cargo build --features afbv4

OCI container (podman/docker)

cd oci-15118
podman build -t afb-iso15118 -f Dockerfile

Configuration

Configuration relies on standard binding/binder json/yaml config file. The config splits into three main part:

  • Iso stack to load 15118-2, 15118-20, Din, SLAC, ...
  • Network/TLS: defined the interface to use as well as TLS certificates
  • Verbs: defines which ISO message should be exposed.

Interface to service discovery prefix allows to select the interface IPV6 to be used. 0xFE80 is the default for ipv6 local-link.

iface: ${IFACE_SIMU}   # default lo
ip6_prefix:  0         # default 0xFE80
sdp_port:    15118     # default 15118

TLS configuration optional pin is private key's password. psklog_in a user defined filepath for Wireshark pre-shared-key. PSK allows to introspect crypt TLS communication from wireshark UI as if it was a clear text TCP channel.

    trust: ${PKI_TLS_DIR}/_trialog/
    certs: ${PKI_TLS_DIR}/_trialog/secc-chain.pem
    key: ${PKI_TLS_DIR}/_trialog/secc20Cert.key
    pin: 123456
    proto: SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-ARCFOUR-128:+PSK:+DHE-PSK
    psklog_in: /tmp/tls-keys-simu.log

Api Json/Yaml input query as well as response use JSOn, but configuration on top of JSON also accept YAML.

Debug

To introspect iso15118 trace use dsv2shark wireshark plugin with nss-key-log master keys.

Plugin:

Using NSS-KEY-LOG master key file to decrypt TLS with wireshark

wireshark iso15118-binding-rs/afb-test/trace-logs/hello2-tls-1.3.pcapng -o tls.keylog_file:iso15118-binding-rs/afb-test/trace-logs/hello2-tls-1.3.keylog

Current development status

This module is under deep development. Initial version supports ISO-2, the other stacks (Iso-20, Din) will come as soon as iso15118-encoder-rs implements them.

Usage

The simulator might be used in standalone mode to in conjunction with injector-binding-rs to automate testing scenarios.

Test

cargo test --package iso15118-2 --lib -- encoders_test --show-output

Scenarios files

You may generate your scenarios directly from pcap/pcapng tcpdump files. You may find few pcap sample into afb-test/trace-logs directory and many more from https://github.com/EVerest/logfiles.git where every '*.dump' file uses pcap/wireshark syntax.

Command line

iso15118 --pcap_in=./afb-test/trace-logs/abb-normal-din.pcap --log_path=/tmp/iso15118-scenario.json

Output file

{
  "uid":"./afb-test/trace-logs/abb-normal-din.pcap",
  "info":"/tmp/iso15118-scenario.json",
  "api":"pcap-simu",
  "path":"${CARGO_TARGET_DIR}debug/libafb_iso15118_simulator.so",
  "scenarios":[
    {
      "uid":"scenario-1",
      "target":"iso15118-din",
      "transactions":[
        {
          "uid":"pkg:42",
          "verb":"session_setup_req",
          "delay":16,
          "query":{
            "id":"[02,01,02,03,04,02]",
            "tagid":"session_setup_req"
          },
          "expect":{
            "id":"[00]",
            "rcode":"ok",
            "stamp":0,
            "tagid":"session_setup_res"
          }
        },
        {
          "uid":"pkg:46",
          "verb":"service_discovery_req",
          "delay":12,
          "query":{
            "category":"ev_charger",
            "tagid":"service_discovery_req"
          },
          "expect":{
            "rcode":"ok",
            "charging":{
              "tag":{
                "id":1,
                "category":"ev_charger"
              },
              "transfer":"dc_extended",
              "isfree":false
            },
            "payments":[
              "external"
            ],
            "tagid":"service_discovery_res"
          }
        },
      ],
    }
  ]
}

FULUP: TBD

  • Din -> Json (session request)
  • porter DIN
  • checker la logique du protocol

iso15118-simulator-rs's People

Contributors

fulup-bzh avatar

Watchers

ronan [iot.bzh] avatar Stephane Desneux avatar benierc avatar  avatar  avatar Sylvain [IoT.bzh] avatar Sebastien Douheret avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.