Giter Club home page Giter Club logo

dddp's Introduction

P4++ skeleton

There's not anything useful here yet. It's skeletal. Here are instructions, anyway.

Build dddp

  1. Get the submodules:
git submodule update --init
  1. Install the protobuf compiler:
$ cargo install protobuf-codegen
  1. Install the gRPC compiler:
$ cargo install grpcio-compiler
  1. Build:
cargo build

Build bmv2 simple_switch_grpc

I had to apply the following patch before it worked for me properly. The Makefile.am change was necessary to make the binary link. The main.cpp change was necessary to keep grpc startup from hanging the binary in an infinite loop (this is a grpc bug that is fixed in new-enough grpc, so possibly you won't have it).

diff --git a/targets/simple_switch_grpc/Makefile.am b/targets/simple_switch_grpc/Makefile.am
index 1a8510cc4c93..01e53cdcf959 100644
--- a/targets/simple_switch_grpc/Makefile.am
+++ b/targets/simple_switch_grpc/Makefile.am
@@ -22,7 +22,7 @@ bin_PROGRAMS = simple_switch_grpc
 simple_switch_grpc_SOURCES = main.cpp
 
 simple_switch_grpc_LDADD = \
-libsimple_switch_grpc.la
+libsimple_switch_grpc.la -lpip4info
 
 # We follow this tutorial to link with grpc++_reflection:
 # https://github.com/grpc/grpc/blob/master/doc/server_reflection_tutorial.md
diff --git a/targets/simple_switch_grpc/main.cpp b/targets/simple_switch_grpc/main.cpp
index ae7f32c7b8bb..05a232a5547f 100644
--- a/targets/simple_switch_grpc/main.cpp
+++ b/targets/simple_switch_grpc/main.cpp
@@ -111,3 +111,9 @@ main(int argc, char* argv[]) {
   runner.wait();
   return 0;
 }
+
+void grpc_tracer_init(const char *)
+{}
+
+void grpc_tracer_init()
+{}

Run

  1. Start simple_switch_grpc. From its build directory:
$ ./simple_switch_grpc --no-p4 -- --grpc-server-addr 0.0.0.0:50051 --cpu-port 1010
Calling target program-options parser
Server listening on 0.0.0.0:50051

(If you don't see the second line above then probably grpc startup is hanging as mentioned above.)

  1. Run the p4runtime-cli binary. It has multiple subcommands. Use --help to see them, or <command> --help for details on a subcommand. To set the pipeline, for example:
$ target/debug/p4runtime-cli set-pipeline examples/simple_router/simple_router.p4info.bin examples/simple_router/simple_router.json

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.