summaryrefslogtreecommitdiffstats
path: root/vpp-api/python/vpp_papi
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/python/vpp_papi')
-rw-r--r--vpp-api/python/vpp_papi/pneum_wrap.c8
-rw-r--r--vpp-api/python/vpp_papi/vpp_papi.py8
2 files changed, 10 insertions, 6 deletions
diff --git a/vpp-api/python/vpp_papi/pneum_wrap.c b/vpp-api/python/vpp_papi/pneum_wrap.c
index 7a5119746be..18c4f233869 100644
--- a/vpp-api/python/vpp_papi/pneum_wrap.c
+++ b/vpp-api/python/vpp_papi/pneum_wrap.c
@@ -44,11 +44,11 @@ wrap_pneum_callback (char *data, int len)
static PyObject *
wrap_connect (PyObject *self, PyObject *args)
{
- char *name;
+ char * name, * chroot_prefix = NULL;
int rv;
- PyObject *temp;
+ PyObject * temp;
- if (!PyArg_ParseTuple(args, "sO:set_callback", &name, &temp))
+ if (!PyArg_ParseTuple(args, "sO|s:wrap_connect", &name, &temp, &chroot_prefix))
return (NULL);
if (!PyCallable_Check(temp)) {
@@ -61,7 +61,7 @@ wrap_connect (PyObject *self, PyObject *args)
pneum_callback = temp; /* Remember new callback */
Py_BEGIN_ALLOW_THREADS
- rv = pneum_connect(name);
+ rv = pneum_connect(name, chroot_prefix);
Py_END_ALLOW_THREADS
return PyLong_FromLong(rv);
}
diff --git a/vpp-api/python/vpp_papi/vpp_papi.py b/vpp-api/python/vpp_papi/vpp_papi.py
index 42ddcdc341e..9c2d2b2ba2a 100644
--- a/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/vpp-api/python/vpp_papi/vpp_papi.py
@@ -86,12 +86,16 @@ def handler(signum, frame):
print('Signal handler called with signal', signum)
raise IOError("Couldn't connect to VPP!")
-def connect(name):
+def connect(name, chroot_prefix = None):
# Set the signal handler
signal.signal(signal.SIGALRM, handler)
signal.alarm(3) # 3 second
- rv = vpp_api.connect(name, msg_handler)
+ if not chroot_prefix:
+ rv = vpp_api.connect(name, msg_handler)
+ else:
+ rv = vpp_api.connect(name, msg_handler, chroot_prefix)
+
signal.alarm(0)
#