aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-07-16 14:32:55 +0200
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-07-16 16:33:06 +0000
commitb659020337e3e72f7480098dbee93b45d4dec1f2 (patch)
treeb09da6b4d72d643d4b7768f100feb1ceb45ff1c4 /src/vpp-api/python
parent31b315707f148a087a206214159d8957cc9f9cfb (diff)
papi: use the injected logger wherever possible
As the injected logger is already expected to be used everywhere, this is a fix. The few lines in vpp_serializer.py are not fixed, but they are not encountered in CSIT testing. Functions call_logger and return_logger have single call site each (and confusing names, as they do not log), so saved few lines by inlining them. Type: fix Change-Id: I7dd1e610ef6b885943708bf78bddedfbcf4daa1a Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/vpp-api/python')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_papi.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 5207bbf0bb4..a4523b46329 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -30,8 +30,6 @@ import atexit
from . vpp_serializer import VPPType, VPPEnumType, VPPUnionType
from . vpp_serializer import VPPMessage, vpp_get_type, VPPTypeAlias
-logger = logging.getLogger(__name__)
-
if sys.version[0] == '2':
import Queue as queue
else:
@@ -78,19 +76,6 @@ else:
return d.items()
-def call_logger(msgdef, kwargs):
- s = 'Calling {}('.format(msgdef.name)
- for k, v in kwargs.items():
- s += '{}:{} '.format(k, v)
- s += ')'
- return s
-
-
-def return_logger(r):
- s = 'Return from {}'.format(r)
- return s
-
-
class VppApiDynamicMethodHolder(object):
pass
@@ -220,7 +205,8 @@ class VPPApiClient(object):
to report at (from the loglevels in the logging module).
"""
if logger is None:
- logger = logging.getLogger(__name__)
+ logger = logging.getLogger(
+ "{}.{}".format(__name__, self.__class__.__name__))
if loglevel is not None:
logger.setLevel(loglevel)
self.logger = logger
@@ -631,7 +617,9 @@ class VPPApiClient(object):
pass
self.validate_args(msgdef, kwargs)
- logging.debug(call_logger(msgdef, kwargs))
+ s = 'Calling {}({})'.format(msgdef.name,
+ ','.join(['{!r}:{!r}'.format(k, v) for k, v in kwargs.items()]))
+ self.logger.debug(s)
b = msgdef.pack(kwargs)
self.transport.suspend()
@@ -666,7 +654,7 @@ class VPPApiClient(object):
self.transport.resume()
- logger.debug(return_logger(rl))
+ self.logger.debug('Return from {!r}'.format(r))
return rl
def _call_vpp_async(self, i, msg, **kwargs):
ges. ## Changes Details of the changes leading up to this version of VPP can be found under @ref release_notes. ## Directory layout | Directory name | Description | | ---------------------- | ------------------------------------------- | | build-data | Build metadata | | build-root | Build output directory | | doxygen | Documentation generator configuration | | dpdk | DPDK patches and build infrastructure | | @ref extras/libmemif | Client library for memif | | @ref src/examples | VPP example code | | @ref src/plugins | VPP bundled plugins directory | | @ref src/svm | Shared virtual memory allocation library | | src/tests | Standalone tests (not part of test harness) | | src/vat | VPP API test program | | @ref src/vlib | VPP application library | | @ref src/vlibapi | VPP API library | | @ref src/vlibmemory | VPP Memory management | | @ref src/vnet | VPP networking | | @ref src/vpp | VPP application | | @ref src/vpp-api | VPP application API bindings | | @ref src/vppinfra | VPP core library | | @ref src/vpp/api | Not-yet-relocated API bindings | | test | Unit tests and Python test harness | ## Getting started In general anyone interested in building, developing or running VPP should consult the [VPP wiki](https://wiki.fd.io/view/VPP) for more complete documentation. In particular, readers are recommended to take a look at [Pulling, Building, Running, Hacking, Pushing](https://wiki.fd.io/view/VPP/Pulling,_Building,_Run ning,_Hacking_and_Pushing_VPP_Code) which provides extensive step-by-step coverage of the topic. For the impatient, some salient information is distilled below. ### Quick-start: On an existing Linux host To install system dependencies, build VPP and then install it, simply run the build script. This should be performed a non-privileged user with `sudo` access from the project base directory: ./extras/vagrant/build.sh If you want a more fine-grained approach because you intend to do some development work, the `Makefile` in the root directory of the source tree provides several convenience shortcuts as `make` targets that may be of interest. To see the available targets run: make ### Quick-start: Vagrant The directory `extras/vagrant` contains a `VagrantFile` and supporting scripts to bootstrap a working VPP inside a Vagrant-managed Virtual Machine. This VM can then be used to test concepts with VPP or as a development platform to extend VPP. Some obvious caveats apply when using a VM for VPP since its performance will never match that of bare metal; if your work is timing or performance sensitive, consider using bare metal in addition or instead of the VM. For this to work you will need a working installation of Vagrant. Instructions for this can be found [on the Setting up Vagrant wiki page] (https://wiki.fd.io/view/DEV/Setting_Up_Vagrant). ## More information Several modules provide documentation, see @subpage user_doc for more end-user-oriented information. Also see @subpage dev_doc for developer notes. Visit the [VPP wiki](https://wiki.fd.io/view/VPP) for details on more advanced building strategies and other development notes. ## Test Framework There is PyDoc generated documentation available for the VPP test framework. See @ref test_framework_doc for details.