API: Python and Unix domain socket improvement
Handle the case where buffer overflows.
Then SOCK_SEQPACKET assumption that multiple API messages
are not returned by recv() is broken. Use SOCK_STREAM for
API exchanges instead.
Add support for running tests over sockets.
make test SOCKET=1
Change-Id: Ibe5fd69b1bf617de4c7ba6cce0a7c2b3f97a2821
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 62fc0aa..8b637f0 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -226,8 +226,16 @@
if 'VPP_API_DIR' not in os.environ:
os.environ['VPP_API_DIR'] = os.getenv('VPP_INSTALL_PATH')
+ use_socket = False
+ try:
+ if os.environ['SOCKET'] == '1':
+ use_socket = True
+ except:
+ pass
self.vpp = VPP(logger=test_class.logger,
- read_timeout=read_timeout)
+ read_timeout=read_timeout,
+ use_socket=use_socket,
+ server_address=test_class.api_sock)
self._events = deque()
def __enter__(self):