Skip to content

Migrate to the new version

Jurij Nota edited this page Jul 28, 2021 · 23 revisions

What's new?

The recent update of P4-Utils introduced several improvements, affecting also P4-Learning. Indeed P4-Utils is the framework that makes it possible to create virtual networks with P4 devices in them. Hereafter, we list the most important features that were added or modified.

  • The application is now fully based on Python 3.
  • The legacy JSON configuration file used to start the network has been simplified.
  • The network can now be started also using a Python script and the new NetworAPI.
  • P4Runtime is currently available with a new API.
  • The legacy Thrift API and client have been kept for compytibility reasons.

Notice
P4Runtime is only partially available because of some bugs in the implementation of PI, the gRPC server used by the software switches provided by BMv2. In particular, consider that registers currently cannot be read or written using the P4Runtime API.

All the exercises and examples have been already migrated to the new version and they are now compatible with the new framework. However, should you have customized examples crafted from the old ones, please make sure that you have ported any controller to Python 3 and that the JSON network configuration file is compliant with the new specification.

How to migrate to the new version?

JSON Network Configuration

Consider that obj is the main object contained in the JSON network configuration file (i.e. the p4app.json file contained in the folders of the exercises and examples). Then we have the following changes between the old and the new JSON network configuration file. Please remember that, because of these changes, old JSON configuration files are not compatible with the new version of P4-Utils.

Old version New version Description
obj["program"] obj["p4_src"] Path to the default program for all the P4 switches (string).
obj["switch"] removed Default switch binary to use (string).
obj["compiler"] removed Default compiler binary to use (string).
obj["options"] removed Options to pass to the compiler (string).
obj["switch_cli"] removed Default Thrift client binary to configure the switches (string).
not present obj["tasks_file"] Path to the file that contains all the tasks to execute in the nodes (string).

Python Network Configuration

Clone this wiki locally