Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

buck5060/P4Runtime_Python_Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

20 Commits

Repository files navigation

P4Runtime Python Client

  • Brief Intro

    • Client.py is the main program and basic.py is for library.
    • You can simply run client.py as a client.
    • Alternatively, you can intergrate client.py into other program and call functions in basic.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:

About

Trying to make a P4runtime python clinet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /