[P4-discuss] Couple of questions on BMv2 and P4Runtime

Antonin Bas antonin at barefootnetworks.com
Fri Apr 27 18:28:05 EDT 2018

Hi Tomek,

Please see inline

On Fri, Apr 27, 2018 at 2:46 AM, Tomasz Osiński <osinstom at gmail.com> wrote:

> Hello everyone,
> Our team at Orange Poland continue research work on P4 and technologies
> around. We would like to ask two questions to properly design our PoC:
> 1) We want to use BMv2 as a virtual switch for PoC. However, there is a
> requirement to dynamically modify pipeline confiugration at runtime. Is it
> possible without P4Runtime-capable BMv2 switch, using standard BMv2?

Yes it is possible. bmv2-simple_switch (which is basically the same as
bmv2-simple_switch_grpc without the P4Runtime gRPC server) exposes a Thrift
RPC. The Thrift service has 2 RPCs, bm_load_new_config and bm_swap_configs (
ft_src/standard.thrift#L597), which let you push a different JSON
configuration to the switch. These are also exposed through the
runtime_CLI, so it's really easy to experiment. You just send a new JSON
with bm_load_new_config, program new table entries (while incoming packets
are still processed using the old JSON + old table entries) and when you
are ready you call bm_swap_configs which will replace the old dataplane
with the new one.

That being said, I really recommend using simple_switch_grpc & P4Runtime if

> 2) Regarding P4Runtime I assume it is possible to dynamically re-program
> switch pipeline. Is there any Python library to programmatically control
> P4Runtime-capable BMv2 switch? Also, is there a similar library for
> standard BMv2 configuration?

Yes, P4Runtime lets you dynamically re-configure the pipeline with the
SetForwardingPipeline RPC. When you build and install the p4lang/PI
repository, the Python bindings for P4Runtime get installed. Here is some
example Python code which imports the generated Python module:
Same thing for the Thrift RPC. When you build and install
p4lang/behavioral-mode, Python bindings will be generated and installed for
the Thrift service (I believe they are installed as bm_runtime.standard).

> Thanks,
> Tomek
> _______________________________________________
> P4-discuss mailing list
> P4-discuss at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-discuss_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20180427/d7383275/attachment.html>

More information about the P4-discuss mailing list