[P4-dev] Extending P4Runtime demo to support multiple P4 programs

Antonin Bas antonin at barefootnetworks.com
Tue Oct 17 11:13:31 EDT 2017


Hi Miguel,

I believe that you are confusing the bmv2 JSON with the P4Info message in
JSON format:
- the bmv2 JSON: a JSON description of the forwarding pipeline, which is
required by the bmv2 simple_switch packet-processing binary
- the P4Info message: a protobuf message which describes the data-model to
be used by the control-plane when generating P4 Runtime requests. Although
the compiler lets you generate this in JSON format by using
"--p4runtime-format json", we scarcely use JSON for this: we usually prefer
the "text" format.

You should try running:
p4c-bm2-ss <p4_program> --p4-16 -o out.json
and use out.json instead in SimpleRouterMgr.

Unfortunately, this demo is not super recent, so it's still trying to
generate the P4Info from the bmv2 JSON instead of using the one generated
by the compiler (which is why I didn't include --p4runtime-file in the
compiler invocation above). It should work anyway, but please do let us
know if you run into an issue, and hopefully the demo will be updated in
the upcoming weeks.

Best,

Antonin


On Mon, Oct 16, 2017 at 10:33 AM, Miguel Neves <mcneves at inf.ufrgs.br> wrote:

> Hi
>
> I'm trying to extend the P4Runtime demo ( https://github.com/p4lang/PI/
> tree/master/proto/demo_grpc ) to support other P4 programs in addition to
> the ones provided. I'm aware that I need to modify the SimpleRouterMgr
> class ( https://github.com/p4lang/PI/blob/master/proto/demo_grpc/
> simple_router_mgr.h ) to insert a separate configuration for each program.
>
> The problem raises when I try to assign a new device configuration. I'm
> getting a “Json version requirement not satisfied” message independently
> of the program I try to install. After that, I cannot install any table
> entry.
>
> I've generated the necessary P4 info using the following command:
>
> p4c-bm2-ss <p4_program> --p4-16 -o <output_file> --p4runtime-file
> <p4info_file> --p4runtime-format json
>
> I compared the generated jsons against the simple_router example (
> https://github.com/p4lang/PI/blob/master/proto/demo_grpc/
> simple_router.json ), and in fact the compiler doesn't add a version tag
> to the file.
>
> Any idea? Should the compiler add that tag?
>
> Thanks,
> Miguel
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171017/79685513/attachment-0002.html>


More information about the P4-dev mailing list