Hi Dave,

That documentation is out of date, and the class is VPPApiClient. Here's a
quick demo script for you:

from vpp_papi import VPPApiClient

from vpp_papi import VppEnum

import os

import fnmatch

import sys


vpp_json_dir = '/usr/share/vpp/api/'


# construct a list of all the json api files

jsonfiles = []

for root, dirnames, filenames in os.walk(vpp_json_dir):

  for filename in fnmatch.filter(filenames, '*.api.json'):

    jsonfiles.append(os.path.join(root, filename))


vpp = VPPApiClient(apifiles=jsonfiles, server_address='/run/vpp/api.sock')

vpp.connect("test-client")


r = vpp.api.show_version()

print('VPP version is %s' % r.version)


iface_list = vpp.api.sw_interface_dump()

for iface in iface_list:

  print(iface)

  if iface.link_duplex ==
VppEnum.vl_api_link_duplex_t.LINK_DUPLEX_API_UNKNOWN:

    ## Do something with this match

    pass

To your other question, vppctl is the debug CLI. You cannot issue API calls
with that tool. Take a look at *vat2*, which can send an API message to VPP
and print its reply, or use the generated API client *vpp_api_test.*

Hope that helps, groet,
Pim

On Tue, Jul 12, 2022 at 3:26 PM Dave Houser <davehous...@gmail.com> wrote:

> Hello,
>
> I am new to working with the vpp-api. I tried reading the documentation
> found here <https://wiki.fd.io/view/VPP/Python_API>, however I am unable
> import "VPP" from "vpp_papi". Looking at the source for
> "/usr/lib/python3/dist-packages/vpp_papi/vpp_papi.py", there is no class
> called "VPP".
>
> I am a total newb working with vpp-api, can someone point me in the right
> direction on how I can get started? Main goal is to create an ACL, add
> ACE's, change them, and remove them.
>
> Any help would be appreciated, thanks!
>
> - Dave
>
> 
>
>

-- 
Pim van Pelt <p...@ipng.nl>
PBVP1-RIPE - http://www.ipng.nl/
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#21645): https://lists.fd.io/g/vpp-dev/message/21645
Mute This Topic: https://lists.fd.io/mt/92332743/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to