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

Antonin Bas antonin at barefootnetworks.com
Wed Oct 25 16:47:36 EDT 2017


Hi,

I have merged a patch that fixes this: https://github.com/p4lang/PI/pull/218
However, note that this patch also updates the demo so that the
compiler-generated p4info message can be used (generated with
--p4runtime-file <> --p4runtime-format text), as explained in my previous
email. I checked-in the generated p4info messages for simple_router.p4 and
simple_router_wcounter.p4.

On Sat, Oct 21, 2017 at 12:24 PM, Miguel Neves <mcneves at inf.ufrgs.br> wrote:

> Hi Antonin
>
> Thanks for your reply. I tried to run the demo compiling P4 programs from
> the P4D2_2017_Spring tutorial. There was a segmentation fault for every
> bmv2 JSON when trying to read a table specification.
>
> More specifically, I think the issue is in the "read_tables" function at
> the "bmv2_json_reader.c" file ( https://github.com/p4lang/PI/blob/
> b8d937fa72650eb6ec57d2e5755e0c9103fa995f/src/config_readers/
> bmv2_json_reader.c ).
>
> Any idea?
>
> Best,
>
> Miguel
>
> On 10/17/2017 01:13 PM, Antonin Bas wrote:
>
> 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/t
>> ree/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/sim
>> ple_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/sim
>> ple_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
>
>
> --
> Miguel Neves
> PhD student in Computer Science
> Federal University of Rio Grande do Sul (UFRGS)http://www.inf.ufrgs.br/~mcneves/
>
>


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


More information about the P4-dev mailing list