Giter VIP home page Giter VIP logo

draw2p4's Introduction

draw2p4

This is an experimental project to transform graphs into P4 code

Motivation

While teaching we realised that sometimes, initiating a new project in P4 was challenging for new students. Besides, having to check out header structures and write the structure in P4 made the process slightly longer than we wanted. Apart from this we saw that in some cases, there might be a reduced knowledge on how headers are parsed and which order they follow, even if students do generally remember to which layer a particular protocol or header belongs to. As a result we ended up drawing simple graphs to explain the steps of header parsing and describe how the parser should look like.

As a result, thought that we could design a process that started with drawing graphs and that could be later transformed into a full template of a P4 program, that autogenerates the headers, the parsing block the deparser and the skeleton for the rest of the program (as, for instance, the logic of the ingress or egress is tightly coupled to the functionality it provides and thus, difficult to express as a graph).

The process of designing this resulted in a mix of tools to create graphs in the browser, export it and transform it to a P4 project that has several blocks autogenerated. In particular the headers, parser and deparser are completely generated from the graph, leaving the rest to the programmer. We belive that this tools is useful for new students, developers with fair knowledge in networking and newcomers to the P4 world. The compendium of tools presented here let's programmers quickly create a parsing graph and obtain the equivalent P4 code, easing the process of creating a new P4 program. In the future, the tool is expected to be duplex, so it should be able to convert graphs into P4 code and P4 code into graphs (not considering, for now, anything else but headers, parsers and deparser.

This tool also includes a set of pre-defined blocks with well-known headers and parsing states that will ease the process for programmers. By importing this library in the online graphing tool, one can generate the parser from the pre-defined blocks we have created.

Other comments

There is a somehow related project called P4-HLIR you can check. Although it is a much more complete and handy project, it targets P4_14 and does not support (AFAWK) graph to P4 translation.

How to generate graphs and convert them to P4

Coming ...

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.