VPP Python API invocation mechanism has changed in 18.04

Bug #1756051 reported by Onong Tayeng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-vpp
Fix Released
Undecided
Onong Tayeng

Bug Description

This is what happens to ML2 agent with the latest VPP master build, ie, 18.04:

[-] Exception in vpp watcher thread
 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/networking_vpp/agent/vpp.py", line 361, in vpp_watcher_thread
     for name, data in self.get_vhostusers():
   File "/usr/lib/python2.7/site-packages/networking_vpp/agent/vpp.py", line 69, in get_vhostusers
     t = self.call_vpp('sw_interface_vhost_user_dump')
   File "/usr/lib/python2.7/site-packages/networking_vpp/agent/vpp.py", line 230, in call_vpp
     func_call = getattr(self._vpp, func)
 AttributeError: VPP instance has no attribute 'sw_interface_vhost_user_dump'

And its not just for the API in the stack trace above; it is the same for every API that ML2 agent tries to invoke. But the APIs invoked through VAT work fine.

Following commit is the cause:

otayeng@OTAYENG-M-X2RR:~/vpp/git/vpp/src/vpp-api/python$ git show 49bec57f2534a9d8b14e6fc9f9e15427bb42f895
commit 49bec57f2534a9d8b14e6fc9f9e15427bb42f895
Author: Klement Sekera <email address hidden>
Date: Sat Feb 17 11:10:30 2018 +0100

    vpp_papi: remove legacy way of calling VPP APIs

    This allows VPP to define APIs which conflict with internal
    function names used in vpp_papi without issues.

    Change-Id: I56c21814e1c11fa2aa6bcd95adb3fdeacd304e8e
    Signed-off-by: Klement Sekera <email address hidden>

diff --git a/src/vpp-api/python/vpp_papi.py b/src/vpp-api/python/vpp_papi.py
index 25a83695..c2d12b5b 100644
--- a/src/vpp-api/python/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi.py
@@ -611,13 +611,6 @@ class VPP():
                 multipart = True if name.find('_dump') > 0 else False
                 f = self.make_function(name, i, msgdef, multipart, async)
                 setattr(self._api, name, FuncWrapper(f))
-
- # old API stuff starts here - will be removed in 17.07
- if hasattr(self, name):
- raise NameError(
- 3, "Conflicting name in JSON definition: `%s'" % name)
- setattr(self, name, f)
- # old API stuff ends here
             else:
                 self.logger.debug(
                     'No such message type or failed CRC checksum: %s', n)
otayeng@OTAYENG-M-X2RR:~/vpp/git/vpp/src/vpp-api/python$

VPP Python API invocation mechanism has changed. VPP version 18.04 onwards, the VPP APIs are attributes of the "api" object within the VPPInterface object whereas before 18.04, VPP APIs
are attributes of the VPPInterface object itself.

The new way of invoking the API would be:

        1. # show vpp version

 2. rv = vpp.api.show_version()

 3. print('VPP version =', rv.version.decode().rstrip('\0x00'))

Onong Tayeng (onong)
Changed in networking-vpp:
assignee: nobody → Onong Tayeng (onong)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-vpp (master)

Fix proposed to branch: master
Review: https://review.openstack.org/553366

Changed in networking-vpp:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-vpp (master)

Reviewed: https://review.openstack.org/553366
Committed: https://git.openstack.org/cgit/openstack/networking-vpp/commit/?id=5caa61809fd7ab3332b770af761351d0ce4559fe
Submitter: Zuul
Branch: master

commit 5caa61809fd7ab3332b770af761351d0ce4559fe
Author: Onong Tayeng <email address hidden>
Date: Thu Mar 15 17:18:39 2018 +0530

    VPP Python API invocation mechanism has changed in 18.04

    VPP version 18.04 onwards, the VPP APIs are attributes of the "api"
    object within the VPPInterface object whereas before 18.04, VPP APIs
    are attributes of the VPPInterface object itself. As a result, none of the
    VPP API calls work in the ML2 agent when run against VPP version 18.04.

    This change ensures that we work with VPP version 18.04 and onwards while
    still being backwards compatible.

    Change-Id: Iac4d41a4295cfbd6985a8f0f2595e73e141a116c
    Closes-Bug: #1756051

Changed in networking-vpp:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.