papi: change default to use socket transport instead of shared memory transport
[vpp.git] / src / vpp-api / python / vpp_papi / vpp_papi.py
index b5310a1..25f4727 100644 (file)
@@ -386,9 +386,9 @@ class VPPApiClient:
     VPPIOError = VPPIOError
 
 
-    def __init__(self, apifiles=None, testmode=False, async_thread=True,
+    def __init__(self, *, apifiles=None, testmode=False, async_thread=True,
                  logger=None, loglevel=None,
-                 read_timeout=5, use_socket=False,
+                 read_timeout=5, use_socket=True,
                  server_address='/run/vpp/api.sock'):
         """Create a VPP API object.
 
@@ -686,6 +686,15 @@ class VPPApiClient:
                                                            n[1]['avg'], n[1]['max'])
         return s
 
+    def get_field_options(self, msg, fld_name):
+        # when there is an option, the msgdef has 3 elements.
+        # ['u32', 'ring_size', {'default': 1024}]
+        for _def in self.messages[msg].msgdef:
+            if isinstance(_def, list) and \
+                    len(_def) == 3 and \
+                    _def[1] == fld_name:
+                return _def[2]
+
     def _call_vpp(self, i, msgdef, service, **kwargs):
         """Given a message, send the message and await a reply.
 
@@ -908,13 +917,8 @@ class VPPApiClient:
         while True:
             kwargs['cursor'] = cursor
             rv, details = f(**kwargs)
-            #
-            # Convert to yield from details when we only support python 3
-            #
             for d in details:
                 yield d
             if rv.retval == 0 or rv.retval != -165:
                 break
             cursor = rv.cursor
-
-# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4