[P4-dev] Query regarding P4 bmv2 code versions and specs

Andy Fingerhut andy.fingerhut at gmail.com
Tue Aug 1 16:07:39 EDT 2017


p4c-bm2-ss executable produces a JSON file intended to be used by the
simple_switch executable.

I am sure there are other supported options, but that is the one I have
used most often.  That and p4test, which does not produce a JSON file, but
basically only gives you warning and error messages from parsing and doing
some limited semantic analysis on the P4 source code.

Andy

On Tue, Aug 1, 2017 at 12:32 PM, Hardik Soni <hardik.soni at inria.fr> wrote:

> Thank you Andy for clarifications on P4 versions and specs.
> For question 2, I was looking for commands to compile of P4 programs with
> appropriate options, not p4c and bmv2 itself.
> I can see that p4c and p4c-bm2-ss, both binaries can compile both versions
> of P4 programs.
> So, there was some confusion there for me.
>
> -Hardik
>
> ------------------------------
>
> *From: *"Andy Fingerhut" <andy.fingerhut at gmail.com>
> *To: *"Hardik Soni" <hardik.soni at inria.fr>
> *Cc: *"p4-dev" <p4-dev at lists.p4.org>
> *Sent: *Tuesday, 1 August, 2017 6:21:20 PM
> *Subject: *Re: [P4-dev] Query regarding P4 bmv2 code versions and specs
>
>
> Q1:
>
> If you go to p4.org and click on the SPEC link near the upper right you
> get to this page: https://p4lang.github.io/p4-spec/
>
> That is where the most recently released versions of the language specs
> are published.  It currently includes v1.0.4 of the P4_14 language, which
> is still the same syntax as older versions of the P4_14 language, and
> version 1.0.0 of the P4_16 language, which has a noticeably different
> syntax.
>
> Q2:
>
> I have run this bash script to mostly automate the steps given in the
> relevant README's for the behavioral-model and p4c Github projects, to get
> a copy of those repositories and build them.  As mentioned in the READMEs,
> it also gets a copy of Google protobuf and builds and installs that,
> required for building p4c.
>
> https://github.com/jafingerhut/p4-guide/blob/master/bin/install-p4dev.sh
>
> I have only ever tested that script on an Ubuntu 16.04 Linux machine.
>
> Q3:
>
> I do not know enough about the init_objects() method that you mention to
> know whether there are any significant differences in how that method is
> called between P4_14 and P4_16 JSON files produced by the compiler.
> Sorry.  Perhaps someone else can help there, or you can just try an
> experiment with it and see if things go well.
>
> Andy
>
>
> On Tue, Aug 1, 2017 at 3:29 AM, Hardik Soni <hardik.soni at inria.fr> wrote:
>
>> Hello All,
>>
>> I need some information on versions of specs, p4c code and bmv2 code.
>>
>> Q1:
>>
>> There is a spec (Version 1.0.3) of P416 dated November 2, 2016.
>> That BNF is not of P416 compiler, am I right?
>> A recent, May 2017, spec has different grammar.
>>
>>
>> Q2:
>> I have BMV2 clone with following last commit.
>> ----------------------------------------------------------------------
>>
>> commit 41c1f2ed487ff086a1d582069e8bc68cab8ffdb0
>> Author: Antonin Bas <antonin at barefootnetworks.com>
>> Date: Fri Jul 7 11:49:00 2017 -0700
>>
>> Fix installation for simple_switch_grpc (#409)
>> Fixed error: "Recursive variable 'includep4bmdir' references itself"
>>
>> ----------------------------------------------------------------------
>>
>>
>> And
>>
>> I have p4c compiler clone with following last commit.
>>
>>
>> ----------------------------------------------------------------------
>>
>> commit ae458b34014e23f095accac80088757a07612a7a
>> Author: Calin Cascaval <cascaval at barefootnetworks.com>
>> Date: Tue Jul 11 21:02:41 2017 -0700
>>
>> proper path to include directory
>>
>> ----------------------------------------------------------------------
>>
>>
>> If any one can confirm the exact commands to compile for
>> bmv2(simple_switch target) and run on it, it will be great.(for the above
>> commit versions)
>>
>> Though, I used python script in mininet folder.
>>
>>
>>
>> And the most important question
>>
>> Q3:
>>
>> I could run simple_router  json file(probably precompile from P414 ) on
>> bmv2 simple_router target.
>>
>> It could run safely.
>>
>> So, is there any big change in execution of json files of P414 and p416?
>>
>>
>> Being more precise, my code heavily depends on
>>
>> P4Objects::init_objects(std::istream *is,  LookupStructureFactory
>> *lookup_factory, int device_id, size_t cxt_id,
>>
>>                                     std::shared_ptr<TransportIface>
>> notifications_transport, const std::set<header_field_pair>
>>
>>                                     &required_fields, const ForceArith
>> &arith_objects) {
>>
>> /* All the data structures(maps and vectors etc) being initialized here */
>>
>> }
>>
>>
>> Is there any difference in filling up the data-structures for P4-14 and
>> p4-16 jsons?
>>
>>
>>
>>
>> Best Regards,
>> Hardik Soni
>>
>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170801/f18225d9/attachment-0002.html>


More information about the P4-dev mailing list