Git Product home page Git Product logo

eth-py-scapy's Introduction

eth-py-scapy

Automotive Ethernet SOME/IP-SD Scapy extensions (Autosar 4.2)

1. What is this?

eth-py-scapy is a Python package implementing Automotive Ethernet SOME/IP-SD protocol over Scapy.

It's meant to be used as a central pillar to design and implement the "host end" of a 'uC <--> PC' net topology in a flexible and effective way. Due to its multiplatform nature, you can use as "host end" devices ranging from a full fledged PC to a Raspberry Pi (or many!), being then able to build complex SOME/IP-SD networks on the cheap.

Either if you need to test your ECU or microcontrolled based SOME/IP-SD implementation, or just want to learn how SOME/IP-SD works, eth-py-scapy is here to help you.

2. Configuration

2.1 VLAN

Depending on your net's topology design, it might be that VLAN (IEEE 802.1q) tagging is required. With Linux, it's a breeze to get it working, just follow a guideline like this one : https://wiki.ubuntu.com/vlan

For Windows systems (at least up to Win7), as far as we know, VLAN configuration depended totally on the capabilities of your internet interface's driver, so choose your hardware wisely!

2.2 Interface configuration (Linux)

Below you can find an example /etc/network/interfaces for eth1, both with/without VLAN.

# eth1
iface eth1 inet static
    address 10.0.0.1
    netmask 255.255.255.0
# VLAN eth1
iface eth1.10 inet static
    address 10.0.0.11
    netmask 255.255.255.0

Now you're just an ifup away from completing the configuration :

$sudo ifup eth1.10    

3. Build your own test collection

We now that sometimes project's timings are so tight, that every help available could make a difference, so we decided to include a very small and simple test infrastructure in order to build test cases from day one (let us insist on the small an simple fact, we invite you to grab eth-py-scapy and adapt it to your own test suite).

3.1 auto_eth_test.py and testcases folder

/eth-py-scapy/auto_eth_test.py
/eth-py-scapy/testcases
/eth-py-scapy/testcases/test_base.py
/eth-py-scapy/testcases/test_example.py
/eth-py-scapy/testcases/test_someip.py

test_cases folder is meant to hold multiple TestCollections definitions, containing each of them a number of TestCases.

On the other hand, auto_eth_test.py is the launcher that takes care of autoexecuting all TestCollections found and formatting TestCases' results presentation. Take a look at its implementation and personalize it!

3.2 TestCase creation and _auto_execution

Creating a new TestCollection is as easy as :

  • create a new python file within testcases folder. Each file represents a test category.
  • within previous file, create a Subclass of baseTest. Populate this class with r'^test.*' functions representing test cases.
  • launch auto_eth_test.py. If you have defined everything correctly, your test collection will be automatically launched.

Use the functions provided by baseTest to organize our test cases and define how feedback is reported from them (error/warning messages ...). As reference, please observe the examples provided.

4. Virtual environment

We know this might not be the best distribution method available, but using virtualenv we are almost completely sure that you will be able to play with eth-py-scapy right out of the git clone ;) Only requirement is to have Python installed on your system.

4.1 Restore virtualenv

Open a bash console and enter virualenv folder, from there execute following commands:

$ virtualenv env
$ source env/bin/activate
$ env/bin/pip install -r requirements.txt

Now you have your new and shiny virtual enviroment ready!

4.2 Run it!!

In order to run auto_eth_test.py :

  • activate virtualenv : $source virtualenv/env/bin/activate
  • execute auto_eth_test.py using sudo
    • option 1 (specify path to python bin within virtualenv) : $sudo ./virtualenv/env/bin/python auto_eth_test.py
    • option 2 (make etester.py executable, add #!./virtualenv/env/bin/python as script 1st line) : $sudo ./auto_eth_test.py

Once you are finished, deactivate virtualenv with deactivate

5. References

eth-py-scapy's People

Contributors

dependabot[bot] avatar jamores avatar markszabo avatar urnenfeld avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.