VPP/Python API
From fd.io
Python binding for the VPP API
The vpp-papi.py module in vpp-api-test/papi provides a Python 3 binding to the VPP API.
Example
#!/usr/bin/env python3
import vpp_papi
r = vpp_papi.connect("test_papi")
t = vpp_papi.show_version()
print('VPP version:', t.version.decode())
t = vpp_papi.sw_interface_dump(0, b'ignored')
if t:
print('List of interfaces')
for interface in t:
if interface.vlmsgid == vpp_papi.VL_API_SW_INTERFACE_DETAILS:
print(interface.interfacename.decode())
r = vpp_papi.disconnect()
API generation
The Python binding is automatically generated from the API definition in vpp/api/vpe.api. See figure below.
