Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to enforce a given JSON configuration on a given device, applications needs to need to provide a “BMv2 Device Context”. Device contexts are used to bind together in a Java class a BMv2 JSON configuration and an “Interpreter” implementation. Interpreters are used by ONOS to “understand” a given P4 program. They provide a mapping between ONOS objects and program-specific P4 objects (e.g. headers, actions, table names, etc.), allowing existing services and apps (e.g. host tracking, LLDP discovery, ARP proxy, reactive forwarding, etc.) to work with virtually any P4 program.

...

While for criteria and tables it is possible to specify a 1-to-1 relationship through a map, for Instructions the same is not possible or at least it wouldn't’ be s not convenient. The reason is that Instructions in ONOS are modeled after OpenFlow actions (which are protocol-dependent) and , while flow rule treatments (to be applied as a consequence of a match) are usually defined as a list of multiple instructions. In P4 instead, actions are defined as a compound of low-level protocol-independent primitives (not expressible using ONOS Instructions), and, most important, P4 allows to specify only one action per table entry. Extracting the "meaning" of a given treatment instance and mapping it to a P4 action is not straightforward and might be prograprogram-specific, . That’s why we expect a P4 programmer using ONOS to write its own interpretation logic (i.e. Java code) that can map a given treatment instance to a BMv2 action instance.

...

When devices connect for the first time to ONOS a “default” context is automatically applied, triggering a configuration swap on the device and exposing to the system a default interpreter. Such a context is used to provide a minimum set of data plane capabilities for basic ONOS services and apps to work. The default context is based on a default.json BMv2 configuration, (compiled from default.p4) and default interpreter implementation.

FAQ regarding

...

interpreters

  • Do I necessarily need to write an interpreter for my P4 program?
    No, interpreters are optional, meaning that a context can be created with an “empty” interpreter. In this case, you can’t expect other ONOS services to work with that given context. When not using an Interpreter or when creating flow rules based on non-standard match or actions, developers can use BMv2 extension treatment and selectors.
  • Do I need to provide a mapping for all the headers and actions defined in my P4 program?
    No, you can provide a mapping for only some of them. The general advice is to provide a mapping for those criterions and treatments used by the other ONOS services and applications you need in order to run your applications. Most of the times you can re-use the default interpreter (provided that you write your own P4 program upon default.p4) 

 

Anchor
extensions
extensions
Non-standard match and actions (WIP)

ONOS already provides means for applications to process traffic according to match and actions on non-standard header fields...

...