aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/python
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/python')
-rw-r--r--vpp-api/python/pneum/pneum.c5
-rw-r--r--vpp-api/python/pneum/pneum.h2
-rw-r--r--vpp-api/python/pneum/test_pneum.c2
-rw-r--r--vpp-api/python/vpp_papi/pneum_wrap.c8
-rw-r--r--vpp-api/python/vpp_papi/vpp_papi.py8
5 files changed, 16 insertions, 9 deletions
diff --git a/vpp-api/python/pneum/pneum.c b/vpp-api/python/pneum/pneum.c
index 7250cf6a90e..ebe47b2f419 100644
--- a/vpp-api/python/pneum/pneum.c
+++ b/vpp-api/python/pneum/pneum.c
@@ -116,11 +116,14 @@ pneum_rx_thread_fn (void *arg)
}
int
-pneum_connect (char *name)
+pneum_connect (char * name, char * chroot_prefix)
{
int rv = 0;
pneum_main_t *pm = &pneum_main;
+ if (chroot_prefix != NULL)
+ vl_set_memory_root_path (chroot_prefix);
+
if ((rv = vl_client_api_map("/vpe-api"))) {
clib_warning ("vl_client_api map rv %d", rv);
return rv;
diff --git a/vpp-api/python/pneum/pneum.h b/vpp-api/python/pneum/pneum.h
index 75fccf84bcf..75b10f8df45 100644
--- a/vpp-api/python/pneum/pneum.h
+++ b/vpp-api/python/pneum/pneum.h
@@ -15,7 +15,7 @@
#ifndef included_pneum_h
#define included_pneum_h
-int pneum_connect(char *name);
+int pneum_connect(char * name, char * chroot_prefix);
int pneum_disconnect(void);
int pneum_read(char **data, int *l);
int pneum_write(char *data, int len);
diff --git a/vpp-api/python/pneum/test_pneum.c b/vpp-api/python/pneum/test_pneum.c
index b3131953e8f..20c29a7e754 100644
--- a/vpp-api/python/pneum/test_pneum.c
+++ b/vpp-api/python/pneum/test_pneum.c
@@ -76,7 +76,7 @@ int main (int argc, char ** argv)
vl_api_show_version_t message;
vl_api_show_version_t *mp;
int async = 1;
- int rv = pneum_connect("pneum_client");
+ int rv = pneum_connect("pneum_client", NULL);
if (rv != 0) {
printf("Connect failed: %d\n", rv);
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)
#