|
1 | 1 |
|
2 | 2 | [comment]: # (SPDX-License-Identifier: Apache-2.0)
|
3 | 3 |
|
4 |
| -# Implementing a Control Plane using P4Runtime |
| 4 | +# WORK IN PROGRESS |
5 | 5 |
|
6 | 6 | ## Introduction
|
7 | 7 |
|
@@ -101,6 +101,31 @@ to convert the names into the IDs that are required for P4Runtime. Any changes
|
101 | 101 | in the P4 program that add or rename tables, keys, or actions will need to be
|
102 | 102 | reflected in your table entries.
|
103 | 103 |
|
| 104 | +### Notes on the CPU port, PacketIn and PacketOut messages, and controller metadata |
| 105 | + |
| 106 | +You _MUST NOT_ associate the CPU port number with an interface, |
| 107 | +i.e. it would cause problems if you added a command line option |
| 108 | +`-i 510@veth16` to the example command line above. The CPU port is |
| 109 | +special in that effectively one end is connected to the BMv2 switch |
| 110 | +on the CPU port, and the other end is always connected to the |
| 111 | +P4Runtime API server code that runs within the `simple_switch_grpc` |
| 112 | +process. |
| 113 | + |
| 114 | +All packets sent by your P4 code to the CPU port go to this P4Runtime |
| 115 | +API server, are sent via a `PacketIn` message from the server to your |
| 116 | +controller (which is a P4Runtime API client) over the P4Runtime API |
| 117 | +gRPC connection, and become `PacketIn` messages to your controller |
| 118 | +program. The controller metadata header, if you have one, must be the |
| 119 | +_first_ header when the packet is sent to the CPU port by your P4 |
| 120 | +program. |
| 121 | + |
| 122 | +All `PacketOut` messages from your controller program go over the |
| 123 | +P4Runtime API grPC connection to the P4Runtime API server code running |
| 124 | +inside of the `simple_switch_grpc` process, and are then sent into the |
| 125 | +CPU port for your P4 program to process. The controller metadata |
| 126 | +header, if any, will always be the _first_ header of the packet as |
| 127 | +seen by your P4 parser. |
| 128 | + |
104 | 129 | ## Step 2: Implement Tunnel Forwarding
|
105 | 130 |
|
106 | 131 | The `mycontroller.py` file is a basic controller plane that does the following:
|
|
0 commit comments