-
Brief Intro
Client.pyis the main program andbasic.pyis for library.- You can simply run
client.pyas a client. - Alternatively, you can intergrate
client.pyinto other program and call functions inbasic.py
-
Usage:
usage: client.py [-h] --device {tofino,bmv2} --p4info P4INFO [--config CONFIG]
[--ctx-json CTX_JSON] [--grpc-addr GRPC_ADDR] --device-id
DEVICE_ID [--skip-config] [--skip-role-config] --election-id
ELECTION_ID [--role-id ROLE_ID]
A simple P4Runtime Client
optional arguments:
-h, --help show this help message and exit
--device {tofino,bmv2}
Target device
--p4info P4INFO Location of p4info proto in text format
--config CONFIG Location of Target Dependant Binary
--ctx-json CTX_JSON Location of Context.json
--grpc-addr GRPC_ADDR
Address to use to connect to P4 Runtime server
--device-id DEVICE_ID
Device id for device under test
--skip-config Assume a device with pipeline already configured
--skip-role-config Assume a device do not need role config
--election-id ELECTION_ID
ID for mastership election
--role-id ROLE_ID ID for distinguish different client
- Example of Usage
python client.py --device-id 1 --device bmv2 --grpc-addr 127.0.0.1:54717 --election-id 66 --role-id 0 \
--config "/home/sdn/onos/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json" \
--p4info "/home/sdn/onos/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info"
-
Clients I found and Referenced:
- Python: I ref code in [1] for this program. [2]
- C++: [3] uses simple_switch(not simple_swithc_grpc) as simulation environment, which use nanomsg for Packet IO(i.e. packet in/out). Currently, Packet IO is transmit with GRPC stream
- Java: [4] Which is too hard for me to understand. @@
-
Dependence
- PI commit: 539e4624f16aac39f8890a6dfb11c65040e735ad
- grpc and etc.
-
References:
- [1] fabric-p4test
- [2] P4 tutorials P4runtime
- [3] demo_grpc
- [4] ONOS Soundbound