Hi Christophe,

Looking into the link you sent.
Thanks!

-----Original Message-----
From: Christophe FONTAINE [mailto:christophe.fonta...@qosmos.com] 
Sent: 23 January 2017 00:35
To: Lenny Lyytinen; vpp-dev@lists.fd.io
Subject: Re: Python API over 17.01

Hi Lenny,

As you saw, the python API v1.3 has been totally reworked.
You have first to create a VPP() instance, which will load all api.json files, 
then to call the connect method:


import vpp_papi
_vpp = vpp_papi.VPP()
_vpp.connect("test")

/!\ If you use python in interactive mode. you will not be able to call dir() 
on _vpp instance before the connection.

Also, if you call help on any method, you will see the other major modification 
in the API: all parameters have to be named.
For example,

_vpp.create_vlan_subif(sw_if_index=1, vlan_id=42)

If you want more examples, you can find one in the VPP tree, as make test uses 
the python API, and the OpenStack networking-ml2 plugin.
https://github.com/openstack/networking-vpp/blob/master/networking_vpp/agent/vpp.py

Christophe

________________________________
From: vpp-dev-boun...@lists.fd.io <vpp-dev-boun...@lists.fd.io> on behalf of 
Lenny Lyytinen <len...@checkpoint.com>
Sent: Sunday, January 22, 2017 17:14
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] Python API over 17.01

Hi,

I've experimented with vpp_papi over VPP 16.03 recently. The way I got the 
vpp_papi to work was by downloading the rpm that was available in the wiki, 
which seems different from what I can install from the source: In the rpm I got 
a library which let me perform operations by calling methods directly from the 
module. For example:

import vpp_papi
vpp_papi.connect('test')
vpp_papi.sw_interface_dump(0, b'ignored')

This approach seems to be supported also by the wiki, the unit tests included 
in the source, and previous messages in this mailing list.

However, with the API in src/vpp-api/python, it appears that I need to create a 
VPP() object and provide it with an API file. I saw that there are a bunch of 
.api files in the source, each with its own family of methods.

Today I've upgraded to 17.01, and the Python module I already had no longer 
works (I get a segfault on vpp_papi.connect), and an rpm is no longer available 
in the wiki.

Is the VPP() object the new approach to using the API, and I should alter my 
code to support it; or did I do something wrong and my script should still work?

Thanks,
Lenny
This message, including attachments, is CONFIDENTIAL. It may also be privileged 
or otherwise protected by law. If you received this email by mistake, please 
let us know by reply and then delete it from your system; you should not copy 
it or disclose its contents to anyone. All messages sent to and from Enea may 
be monitored to ensure compliance with internal policies and to protect our 
business. Emails are not secure and cannot be guaranteed to be error free as 
they can be intercepted, amended, lost or destroyed, or contain viruses. The 
sender therefore does not accept liability for any errors or omissions in the 
contents of this message, which arise as a result of email transmission. Anyone 
who communicates with us by email accepts these risks.

Email secured by Check Point
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to