summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--external_libs/cpp/json/json/json-forwards.h (renamed from external_libs/json/json/json-forwards.h)0
-rw-r--r--external_libs/cpp/json/json/json.h (renamed from external_libs/json/json/json.h)0
-rw-r--r--external_libs/cpp/json/jsoncpp.cpp (renamed from external_libs/json/jsoncpp.cpp)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/PKG-INFO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/LICENSE (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/LICENSE)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/README (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/README)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/doc/enum.rst (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/doc/enum.rst)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/enum.py (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/enum.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/enum/test_enum.py (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/test_enum.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/enum34-1.0.4/setup.py (renamed from scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/setup.py)88
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/LICENSE.txt (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/LICENSE.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/MANIFEST.in (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/MANIFEST.in)4
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/PKG-INFO)920
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/README.rst (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/README.rst)876
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py)1204
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py)68
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py)282
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py)190
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py)590
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py)2384
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py)980
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py)244
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO)920
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/setup.cfg (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.cfg)16
-rw-r--r--[-rwxr-xr-x]external_libs/python/jsonrpclib-pelix-0.2.5/setup.py (renamed from scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.py)148
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/ACKS (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ACKS)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/AUTHORS (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/AUTHORS)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/ChangeLog (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ChangeLog)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/LICENSE (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/LICENSE)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/PKG-INFO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/README (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/README)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/RELEASE-NOTES (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/RELEASE-NOTES)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/doc/source/Makefile (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/Makefile)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/doc/source/conf.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/conf.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/doc/source/index.rst (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/index.rst)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile.egg-info/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/PKG-INFO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile.egg-info/not-zip-safe (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/not-zip-safe)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile.egg-info/top_level.txt (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/top_level.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/linklockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/linklockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/mkdirlockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/mkdirlockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/pidlockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/pidlockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/sqlitelockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/sqlitelockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/lockfile/symlinklockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/symlinklockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/setup.cfg (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.cfg)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/setup.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/test-requirements.txt (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test-requirements.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/test/compliancetest.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/compliancetest.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/test/test_lockfile.py (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/test_lockfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/lockfile-0.10.2/tox.ini (renamed from scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/tox.ini)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/ChangeLog (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/ChangeLog)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/LICENSE.ASF-2 (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.ASF-2)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/LICENSE.GPL-3 (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.GPL-3)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/MANIFEST.in (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/MANIFEST.in)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/PKG-INFO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/daemon/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/daemon/_metadata.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/_metadata.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/daemon/daemon.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/daemon.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/daemon/pidfile.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/pidfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/daemon/runner.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/runner.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/doc/CREDITS (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/CREDITS)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/doc/FAQ (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/FAQ)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/doc/TODO (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/TODO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/doc/hacking.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/hacking.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe (renamed from scripts/automation/trex_control_plane/python_lib/__init__.py)2
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/requires.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/requires.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/version_info.json (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/version_info.json)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/setup.cfg (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.cfg)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/setup.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/scaffold.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/scaffold.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/test_daemon.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_daemon.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/test_metadata.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_metadata.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/test_pidfile.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_pidfile.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test/test_runner.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_runner.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/test_version.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test_version.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/python-daemon-2.0.5/version.py (renamed from scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/version.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/MANIFEST.in (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/Makefile (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/Makefile)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/README.rst (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/README.rst)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/VERSION (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/VERSION)0
-rw-r--r--external_libs/python/termstyle/__init__.py (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/python-termstyle.xml (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/setup.py (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/setup.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/termstyle.py (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/test2.py (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/test2.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/test3.py (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/test3.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/termstyle/test_all.sh (renamed from scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/__init__.py (renamed from src/console/zmq/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/auth/__init__.py (renamed from src/console/zmq/auth/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/auth/base.py (renamed from src/console/zmq/auth/base.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/auth/certs.py (renamed from src/console/zmq/auth/certs.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/auth/ioloop.py (renamed from src/console/zmq/auth/ioloop.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/auth/thread.py (renamed from src/console/zmq/auth/thread.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/__init__.py (renamed from src/console/zmq/backend/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/__init__.py (renamed from src/console/zmq/backend/cffi/__init__.py)0
-rw-r--r--external_libs/python/zmq/backend/cffi/_cdefs.h (renamed from src/console/zmq/backend/cffi/_cdefs.h)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/_cffi.py (renamed from src/console/zmq/backend/cffi/_cffi.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/_poll.py (renamed from src/console/zmq/backend/cffi/_poll.py)0
-rw-r--r--external_libs/python/zmq/backend/cffi/_verify.c (renamed from src/console/zmq/backend/cffi/_verify.c)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/constants.py (renamed from src/console/zmq/backend/cffi/constants.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/context.py (renamed from src/console/zmq/backend/cffi/context.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/devices.py (renamed from src/console/zmq/backend/cffi/devices.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/error.py (renamed from src/console/zmq/backend/cffi/error.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/message.py (renamed from src/console/zmq/backend/cffi/message.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/socket.py (renamed from src/console/zmq/backend/cffi/socket.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cffi/utils.py (renamed from src/console/zmq/backend/cffi/utils.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/__init__.py (renamed from src/console/zmq/backend/cython/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/_device.py (renamed from src/console/zmq/backend/cython/_device.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/_poll.py (renamed from src/console/zmq/backend/cython/_poll.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/_version.py (renamed from src/console/zmq/backend/cython/_version.py)0
-rw-r--r--external_libs/python/zmq/backend/cython/checkrc.pxd (renamed from src/console/zmq/backend/cython/checkrc.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/constants.py (renamed from src/console/zmq/backend/cython/constants.py)0
-rw-r--r--external_libs/python/zmq/backend/cython/context.pxd (renamed from src/console/zmq/backend/cython/context.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/context.py (renamed from src/console/zmq/backend/cython/context.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/error.py (renamed from src/console/zmq/backend/cython/error.py)0
-rw-r--r--external_libs/python/zmq/backend/cython/libzmq.pxd (renamed from src/console/zmq/backend/cython/libzmq.pxd)0
-rw-r--r--external_libs/python/zmq/backend/cython/message.pxd (renamed from src/console/zmq/backend/cython/message.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/message.py (renamed from src/console/zmq/backend/cython/message.py)0
-rw-r--r--external_libs/python/zmq/backend/cython/socket.pxd (renamed from src/console/zmq/backend/cython/socket.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/socket.py (renamed from src/console/zmq/backend/cython/socket.py)0
-rw-r--r--external_libs/python/zmq/backend/cython/utils.pxd (renamed from src/console/zmq/backend/cython/utils.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/cython/utils.py (renamed from src/console/zmq/backend/cython/utils.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/backend/select.py (renamed from src/console/zmq/backend/select.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/devices/__init__.py (renamed from src/console/zmq/devices/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/devices/basedevice.py (renamed from src/console/zmq/devices/basedevice.py)0
-rw-r--r--external_libs/python/zmq/devices/monitoredqueue.pxd (renamed from src/console/zmq/devices/monitoredqueue.pxd)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/devices/monitoredqueue.py (renamed from src/console/zmq/devices/monitoredqueue.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/devices/monitoredqueuedevice.py (renamed from src/console/zmq/devices/monitoredqueuedevice.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/devices/proxydevice.py (renamed from src/console/zmq/devices/proxydevice.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/error.py (renamed from src/console/zmq/error.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/__init__.py (renamed from src/console/zmq/eventloop/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/ioloop.py (renamed from src/console/zmq/eventloop/ioloop.py)0
-rw-r--r--external_libs/python/zmq/eventloop/minitornado/__init__.py (renamed from src/console/zmq/eventloop/minitornado/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/concurrent.py (renamed from src/console/zmq/eventloop/minitornado/concurrent.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/ioloop.py (renamed from src/console/zmq/eventloop/minitornado/ioloop.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/log.py (renamed from src/console/zmq/eventloop/minitornado/log.py)0
-rw-r--r--external_libs/python/zmq/eventloop/minitornado/platform/__init__.py (renamed from src/console/zmq/eventloop/minitornado/platform/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/platform/auto.py (renamed from src/console/zmq/eventloop/minitornado/platform/auto.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/platform/common.py (renamed from src/console/zmq/eventloop/minitornado/platform/common.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/platform/interface.py (renamed from src/console/zmq/eventloop/minitornado/platform/interface.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/platform/posix.py (renamed from src/console/zmq/eventloop/minitornado/platform/posix.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/platform/windows.py (renamed from src/console/zmq/eventloop/minitornado/platform/windows.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/stack_context.py (renamed from src/console/zmq/eventloop/minitornado/stack_context.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/minitornado/util.py (renamed from src/console/zmq/eventloop/minitornado/util.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/eventloop/zmqstream.py (renamed from src/console/zmq/eventloop/zmqstream.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/__init__.py (renamed from src/console/zmq/green/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/core.py (renamed from src/console/zmq/green/core.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/device.py (renamed from src/console/zmq/green/device.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/eventloop/__init__.py (renamed from src/console/zmq/green/eventloop/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/eventloop/ioloop.py (renamed from src/console/zmq/green/eventloop/ioloop.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/eventloop/zmqstream.py (renamed from src/console/zmq/green/eventloop/zmqstream.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/green/poll.py (renamed from src/console/zmq/green/poll.py)0
-rw-r--r--external_libs/python/zmq/log/__init__.py (renamed from src/console/zmq/log/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/log/handlers.py (renamed from src/console/zmq/log/handlers.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/ssh/__init__.py (renamed from src/console/zmq/ssh/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/ssh/forward.py (renamed from src/console/zmq/ssh/forward.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/ssh/tunnel.py (renamed from src/console/zmq/ssh/tunnel.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/__init__.py (renamed from src/console/zmq/sugar/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/attrsettr.py (renamed from src/console/zmq/sugar/attrsettr.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/constants.py (renamed from src/console/zmq/sugar/constants.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/context.py (renamed from src/console/zmq/sugar/context.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/frame.py (renamed from src/console/zmq/sugar/frame.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/poll.py (renamed from src/console/zmq/sugar/poll.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/socket.py (renamed from src/console/zmq/sugar/socket.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/tracker.py (renamed from src/console/zmq/sugar/tracker.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/sugar/version.py (renamed from src/console/zmq/sugar/version.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/__init__.py (renamed from src/console/zmq/tests/__init__.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_auth.py (renamed from src/console/zmq/tests/test_auth.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_cffi_backend.py (renamed from src/console/zmq/tests/test_cffi_backend.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_constants.py (renamed from src/console/zmq/tests/test_constants.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_context.py (renamed from src/console/zmq/tests/test_context.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_device.py (renamed from src/console/zmq/tests/test_device.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_error.py (renamed from src/console/zmq/tests/test_error.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_etc.py (renamed from src/console/zmq/tests/test_etc.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_imports.py (renamed from src/console/zmq/tests/test_imports.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_ioloop.py (renamed from src/console/zmq/tests/test_ioloop.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_log.py (renamed from src/console/zmq/tests/test_log.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_message.py (renamed from src/console/zmq/tests/test_message.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_monitor.py (renamed from src/console/zmq/tests/test_monitor.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_monqueue.py (renamed from src/console/zmq/tests/test_monqueue.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_multipart.py (renamed from src/console/zmq/tests/test_multipart.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_pair.py (renamed from src/console/zmq/tests/test_pair.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_poll.py (renamed from src/console/zmq/tests/test_poll.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_pubsub.py (renamed from src/console/zmq/tests/test_pubsub.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_reqrep.py (renamed from src/console/zmq/tests/test_reqrep.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_security.py (renamed from src/console/zmq/tests/test_security.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_socket.py (renamed from src/console/zmq/tests/test_socket.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_stopwatch.py (renamed from src/console/zmq/tests/test_stopwatch.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_version.py (renamed from src/console/zmq/tests/test_version.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_win32_shim.py (renamed from src/console/zmq/tests/test_win32_shim.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_z85.py (renamed from src/console/zmq/tests/test_z85.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/tests/test_zmqstream.py (renamed from src/console/zmq/tests/test_zmqstream.py)0
-rw-r--r--external_libs/python/zmq/utils/__init__.py (renamed from src/console/zmq/utils/__init__.py)0
-rw-r--r--external_libs/python/zmq/utils/buffers.pxd (renamed from src/console/zmq/utils/buffers.pxd)0
-rw-r--r--external_libs/python/zmq/utils/compiler.json (renamed from src/console/zmq/utils/compiler.json)0
-rw-r--r--external_libs/python/zmq/utils/config.json (renamed from src/console/zmq/utils/config.json)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/constant_names.py (renamed from src/console/zmq/utils/constant_names.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/garbage.py (renamed from src/console/zmq/utils/garbage.py)0
-rw-r--r--external_libs/python/zmq/utils/getpid_compat.h (renamed from src/console/zmq/utils/getpid_compat.h)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/interop.py (renamed from src/console/zmq/utils/interop.py)0
-rw-r--r--external_libs/python/zmq/utils/ipcmaxlen.h (renamed from src/console/zmq/utils/ipcmaxlen.h)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/jsonapi.py (renamed from src/console/zmq/utils/jsonapi.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/monitor.py (renamed from src/console/zmq/utils/monitor.py)0
-rw-r--r--external_libs/python/zmq/utils/pyversion_compat.h (renamed from src/console/zmq/utils/pyversion_compat.h)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/sixcerpt.py (renamed from src/console/zmq/utils/sixcerpt.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/strtypes.py (renamed from src/console/zmq/utils/strtypes.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/win32.py (renamed from src/console/zmq/utils/win32.py)0
-rw-r--r--[-rwxr-xr-x]external_libs/python/zmq/utils/z85.py (renamed from src/console/zmq/utils/z85.py)0
-rw-r--r--external_libs/python/zmq/utils/zmq_compat.h (renamed from src/console/zmq/utils/zmq_compat.h)0
-rw-r--r--external_libs/python/zmq/utils/zmq_constants.h (renamed from src/console/zmq/utils/zmq_constants.h)0
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/PKG-INFO10
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/README.txt203
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/SimpleJSONRPCServer.py229
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/__init__.py6
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py38
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/history.py40
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonclass.py145
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonrpc.py556
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/setup.py28
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/LICENSE.txt11
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/rednose-0.4.1/rednose.py387
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/rednose-0.4.1/setup.py29
-rwxr-xr-xscripts/automation/trex_control_plane/python_lib/zmq_fedora.tar.gzbin1752871 -> 0 bytes
-rwxr-xr-xscripts/automation/trex_control_plane/server/outer_packages.py58
236 files changed, 4471 insertions, 6185 deletions
diff --git a/external_libs/json/json/json-forwards.h b/external_libs/cpp/json/json/json-forwards.h
index ccbdb2b1..ccbdb2b1 100644
--- a/external_libs/json/json/json-forwards.h
+++ b/external_libs/cpp/json/json/json-forwards.h
diff --git a/external_libs/json/json/json.h b/external_libs/cpp/json/json/json.h
index e01991e0..e01991e0 100644
--- a/external_libs/json/json/json.h
+++ b/external_libs/cpp/json/json/json.h
diff --git a/external_libs/json/jsoncpp.cpp b/external_libs/cpp/json/jsoncpp.cpp
index e9f7e986..e9f7e986 100644
--- a/external_libs/json/jsoncpp.cpp
+++ b/external_libs/cpp/json/jsoncpp.cpp
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt b/external_libs/python/__init__.py
index 8b137891..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt
+++ b/external_libs/python/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/PKG-INFO b/external_libs/python/enum34-1.0.4/PKG-INFO
index 428ce0e3..428ce0e3 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/PKG-INFO
+++ b/external_libs/python/enum34-1.0.4/PKG-INFO
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/LICENSE b/external_libs/python/enum34-1.0.4/enum/LICENSE
index 9003b885..9003b885 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/LICENSE
+++ b/external_libs/python/enum34-1.0.4/enum/LICENSE
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/README b/external_libs/python/enum34-1.0.4/enum/README
index 511af984..511af984 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/README
+++ b/external_libs/python/enum34-1.0.4/enum/README
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/__init__.py b/external_libs/python/enum34-1.0.4/enum/__init__.py
index 6a327a8a..6a327a8a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/__init__.py
+++ b/external_libs/python/enum34-1.0.4/enum/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/doc/enum.rst b/external_libs/python/enum34-1.0.4/enum/doc/enum.rst
index 0d429bfc..0d429bfc 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/doc/enum.rst
+++ b/external_libs/python/enum34-1.0.4/enum/doc/enum.rst
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/enum.py b/external_libs/python/enum34-1.0.4/enum/enum.py
index 6a327a8a..6a327a8a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/enum.py
+++ b/external_libs/python/enum34-1.0.4/enum/enum.py
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/test_enum.py b/external_libs/python/enum34-1.0.4/enum/test_enum.py
index d7a97942..d7a97942 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/enum/test_enum.py
+++ b/external_libs/python/enum34-1.0.4/enum/test_enum.py
diff --git a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/setup.py b/external_libs/python/enum34-1.0.4/setup.py
index ecb4944f..4cb9c691 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/enum34-1.0.4/setup.py
+++ b/external_libs/python/enum34-1.0.4/setup.py
@@ -1,44 +1,44 @@
-import os
-import sys
-from distutils.core import setup
-
-if sys.version_info[:2] < (2, 7):
- required = ['ordereddict']
-else:
- required = []
-
-long_desc = open('enum/doc/enum.rst').read()
-
-setup( name='enum34',
- version='1.0.4',
- url='https://pypi.python.org/pypi/enum34',
- packages=['enum'],
- package_data={
- 'enum' : [
- 'LICENSE',
- 'README',
- 'doc/enum.rst',
- 'doc/enum.pdf',
- 'test_enum.py',
- ]
- },
- license='BSD License',
- description='Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4',
- long_description=long_desc,
- provides=['enum'],
- install_requires=required,
- author='Ethan Furman',
- author_email='ethan@stoneleaf.us',
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: BSD License',
- 'Programming Language :: Python',
- 'Topic :: Software Development',
- 'Programming Language :: Python :: 2.4',
- 'Programming Language :: Python :: 2.5',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- ],
- )
+import os
+import sys
+from distutils.core import setup
+
+if sys.version_info[:2] < (2, 7):
+ required = ['ordereddict']
+else:
+ required = []
+
+long_desc = open('enum/doc/enum.rst').read()
+
+setup( name='enum34',
+ version='1.0.4',
+ url='https://pypi.python.org/pypi/enum34',
+ packages=['enum'],
+ package_data={
+ 'enum' : [
+ 'LICENSE',
+ 'README',
+ 'doc/enum.rst',
+ 'doc/enum.pdf',
+ 'test_enum.py',
+ ]
+ },
+ license='BSD License',
+ description='Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4',
+ long_description=long_desc,
+ provides=['enum'],
+ install_requires=required,
+ author='Ethan Furman',
+ author_email='ethan@stoneleaf.us',
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Programming Language :: Python',
+ 'Topic :: Software Development',
+ 'Programming Language :: Python :: 2.4',
+ 'Programming Language :: Python :: 2.5',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ ],
+ )
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/LICENSE.txt b/external_libs/python/jsonrpclib-pelix-0.2.5/LICENSE.txt
index 51fca54c..51fca54c 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/LICENSE.txt
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/LICENSE.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/MANIFEST.in b/external_libs/python/jsonrpclib-pelix-0.2.5/MANIFEST.in
index 42f4acf5..eb0014ad 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/MANIFEST.in
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/MANIFEST.in
@@ -1,2 +1,2 @@
-include *.txt
-include README.rst
+include *.txt
+include README.rst
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/PKG-INFO b/external_libs/python/jsonrpclib-pelix-0.2.5/PKG-INFO
index 9d0f3fca..5dce6b1c 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/PKG-INFO
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/PKG-INFO
@@ -1,460 +1,460 @@
-Metadata-Version: 1.1
-Name: jsonrpclib-pelix
-Version: 0.2.5
-Summary: This project is an implementation of the JSON-RPC v2.0 specification (backwards-compatible) as a client library, for Python 2.6+ and Python 3.This version is a fork of jsonrpclib by Josh Marshall, usable with Pelix remote services.
-Home-page: http://github.com/tcalmant/jsonrpclib/
-Author: Thomas Calmant
-Author-email: thomas.calmant+github@gmail.com
-License: Apache License 2.0
-Description: JSONRPClib (patched for Pelix)
- ##############################
-
- .. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
- :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
-
- .. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
- :target: https://travis-ci.org/tcalmant/jsonrpclib
-
- .. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
- :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
-
-
- This library is an implementation of the JSON-RPC specification.
- It supports both the original 1.0 specification, as well as the
- new (proposed) 2.0 specification, which includes batch submission, keyword
- arguments, etc.
-
- It is licensed under the Apache License, Version 2.0
- (http://www.apache.org/licenses/LICENSE-2.0.html).
-
-
- About this version
- ******************
-
- This is a patched version of the original ``jsonrpclib`` project by
- Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
-
- The suffix *-pelix* only indicates that this version works with Pelix Remote
- Services, but it is **not** a Pelix specific implementation.
-
- * This version adds support for Python 3, staying compatible with Python 2.
- * It is now possible to use the dispatch_method argument while extending
- the SimpleJSONRPCDispatcher, to use a custom dispatcher.
- This allows to use this package by Pelix Remote Services.
- * It can use thread pools to control the number of threads spawned to handle
- notification requests and clients connections.
- * The modifications added in other forks of this project have been added:
-
- * From https://github.com/drdaeman/jsonrpclib:
-
- * Improved JSON-RPC 1.0 support
- * Less strict error response handling
-
- * From https://github.com/tuomassalo/jsonrpclib:
-
- * In case of a non-pre-defined error, raise an AppError and give access to
- *error.data*
-
- * From https://github.com/dejw/jsonrpclib:
-
- * Custom headers can be sent with request and associated tests
-
- * The support for Unix sockets has been removed, as it is not trivial to convert
- to Python 3 (and I don't use them)
- * This version cannot be installed with the original ``jsonrpclib``, as it uses
- the same package name.
-
-
- Summary
- *******
-
- This library implements the JSON-RPC 2.0 proposed specification in pure Python.
- It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
- (it extends where possible), so that projects using ``xmlrpclib`` could easily
- be modified to use JSON and experiment with the differences.
-
- It is backwards-compatible with the 1.0 specification, and supports all of the
- new proposed features of 2.0, including:
-
- * Batch submission (via MultiCall)
- * Keyword arguments
- * Notifications (both in a batch and 'normal')
- * Class translation using the ``__jsonclass__`` key.
-
- I've added a "SimpleJSONRPCServer", which is intended to emulate the
- "SimpleXMLRPCServer" from the default Python distribution.
-
-
- Requirements
- ************
-
- It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
- order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
- and then the ``simplejson`` external library).
- One of these must be installed to use this library, although if you have a
- standard distribution of 2.6+, you should already have one.
- Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
- you are going for full-on optimization you may want to pick it up.
-
- Since library uses ``contextlib`` module, you should have at least Python 2.5
- installed.
-
-
- Installation
- ************
-
- You can install this from PyPI with one of the following commands (sudo
- may be required):
-
- .. code-block:: console
-
- easy_install jsonrpclib-pelix
- pip install jsonrpclib-pelix
-
- Alternatively, you can download the source from the GitHub repository
- at http://github.com/tcalmant/jsonrpclib and manually install it
- with the following commands:
-
- .. code-block:: console
-
- git clone git://github.com/tcalmant/jsonrpclib.git
- cd jsonrpclib
- python setup.py install
-
-
- SimpleJSONRPCServer
- *******************
-
- This is identical in usage (or should be) to the SimpleXMLRPCServer in the
- Python standard library. Some of the differences in features are that it
- obviously supports notification, batch calls, class translation (if left on),
- etc.
- Note: The import line is slightly different from the regular SimpleXMLRPCServer,
- since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- server = SimpleJSONRPCServer(('localhost', 8080))
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
- server.serve_forever()
-
- To start protect the server with SSL, use the following snippet:
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- # Setup the SSL socket
- server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
- server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
- server_side=True)
- server.server_bind()
- server.server_activate()
-
- # ... register functions
- # Start the server
- server.serve_forever()
-
-
- Notification Thread Pool
- ========================
-
- By default, notification calls are handled in the request handling thread.
- It is possible to use a thread pool to handle them, by giving it to the server
- using the ``set_notification_pool()`` method:
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the thread pool: between 0 and 10 threads
- pool = ThreadPool(max_threads=10, min_threads=0)
-
- # Don't forget to start it
- pool.start()
-
- # Setup the server
- server = SimpleJSONRPCServer(('localhost', 8080), config)
- server.set_notification_pool(pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pool (let threads finish their current task)
- pool.stop()
- server.set_notification_pool(None)
-
-
- Threaded server
- ===============
-
- It is also possible to use a thread pool to handle clients requests, using the
- ``PooledJSONRPCServer`` class.
- By default, this class uses pool of 0 to 30 threads. A custom pool can be given
- with the ``thread_pool`` parameter of the class constructor.
-
- The notification pool and the request pool are different: by default, a server
- with a request pool doesn't have a notification pool.
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the notification and request pools
- nofif_pool = ThreadPool(max_threads=10, min_threads=0)
- request_pool = ThreadPool(max_threads=50, min_threads=10)
-
- # Don't forget to start them
- nofif_pool.start()
- request_pool.start()
-
- # Setup the server
- server = PooledJSONRPCServer(('localhost', 8080), config,
- thread_pool=request_pool)
- server.set_notification_pool(nofif_pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pools (let threads finish their current task)
- request_pool.stop()
- nofif_pool.stop()
- server.set_notification_pool(None)
-
- Client Usage
- ************
-
- This is (obviously) taken from a console session.
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
- >>> server.add(5,6)
- 11
- >>> server.add(x=5, y=10)
- 15
- >>> server._notify.add(5,6)
- # No result returned...
- >>> batch = jsonrpclib.MultiCall(server)
- >>> batch.add(5, 6)
- >>> batch.ping({'key':'value'})
- >>> batch._notify.add(4, 30)
- >>> results = batch()
- >>> for result in results:
- >>> ... print(result)
- 11
- {'key': 'value'}
- # Note that there are only two responses -- this is according to spec.
-
- # Clean up
- >>> server('close')()
-
- # Using client history
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
- >>> server.add(5,6)
- 11
- >>> print(history.request)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "method": "add", "params": [5, 6]}
- >>> print(history.response)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "result": 11}
-
- # Clean up
- >>> server('close')()
-
- If you need 1.0 functionality, there are a bunch of places you can pass that in,
- although the best is just to give a specific configuration to
- ``jsonrpclib.ServerProxy``:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> jsonrpclib.config.DEFAULT.version
- 2.0
- >>> config = jsonrpclib.config.Config(version=1.0)
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
- history=history)
- >>> server.add(7, 10)
- 17
- >>> print(history.request)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
- "method": "add", "params": [7, 10]}
- >>> print(history.response)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
- >>> server('close')()
-
- The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
- modifications. The ``dumps`` arguments are almost identical, but it adds three
- arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
- compatibility, and ``notify`` if it's a request that you want to be a
- notification.
-
- Additionally, the ``loads`` method does not return the params and method like
- ``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
- b.) returns the entire structure of the request / response for manual parsing.
-
-
- Additional headers
- ******************
-
- If your remote service requires custom headers in request, you can pass them
- as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
- headers={'X-Test' : 'Test'})
-
- You can also put additional request headers only for certain method invocation:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.Server("http://localhost:8080")
- >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
- ... test_server.ping(42)
- ...
- >>> # X-Test header will be no longer sent in requests
-
- Of course ``_additional_headers`` contexts can be nested as well.
-
-
- Class Translation
- *****************
-
- I've recently added "automatic" class translation support, although it is
- turned off by default. This can be devastatingly slow if improperly used, so
- the following is just a short list of things to keep in mind when using it.
-
- * Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
- * Do not require init params (for exceptions, keep reading)
- * Getter properties without setters could be dangerous (read: not tested)
-
- If any of the above are issues, use the _serialize method. (see usage below)
- The server and client must BOTH have use_jsonclass configuration item on and
- they must both have access to the same libraries used by the objects for
- this to work.
-
- If you have excessively nested arguments, it would be better to turn off the
- translation and manually invoke it on specific objects using
- ``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
- behavior recursively goes through attributes and lists / dicts / tuples).
-
- Sample file: *test_obj.py*
-
- .. code-block:: python
-
- # This object is /very/ simple, and the system will look through the
- # attributes and serialize what it can.
- class TestObj(object):
- foo = 'bar'
-
- # This object requires __init__ params, so it uses the _serialize method
- # and returns a tuple of init params and attribute values (the init params
- # can be a dict or a list, but the attribute values must be a dict.)
- class TestSerial(object):
- foo = 'bar'
- def __init__(self, *args):
- self.args = args
- def _serialize(self):
- return (self.args, {'foo':self.foo,})
-
- * Sample usage
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> import test_obj
-
- # History is used only to print the serialized form of beans
- >>> history = jsonrpclib.history.History()
- >>> testobj1 = test_obj.TestObj()
- >>> testobj2 = test_obj.TestSerial()
- >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
-
- # The 'ping' just returns whatever is sent
- >>> ping1 = server.ping(testobj1)
- >>> ping2 = server.ping(testobj2)
-
- >>> print(history.request)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "method": "ping", "params": [{"__jsonclass__":
- ["test_obj.TestSerial", []], "foo": "bar"}
- ]}
- >>> print(history.response)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
-
- This behavior is turned by default. To deactivate it, just set the
- ``use_jsonclass`` member of a server ``Config`` to False.
- If you want to use a per-class serialization method, set its name in the
- ``serialize_method`` member of a server ``Config``.
- Finally, if you are using classes that you have defined in the implementation
- (as in, not a separate library), you'll need to add those (on BOTH the server
- and the client) using the ``config.classes.add()`` method.
-
- Feedback on this "feature" is very, VERY much appreciated.
-
- Why JSON-RPC?
- *************
-
- In my opinion, there are several reasons to choose JSON over XML for RPC:
-
- * Much simpler to read (I suppose this is opinion, but I know I'm right. :)
- * Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
- * Parsing - JSON should be much quicker to parse than XML.
- * Easy class passing with ``jsonclass`` (when enabled)
-
- In the interest of being fair, there are also a few reasons to choose XML
- over JSON:
-
- * Your server doesn't do JSON (rather obvious)
- * Wider XML-RPC support across APIs (can we change this? :))
- * Libraries are more established, i.e. more stable (Let's change this too.)
-
- Tests
- *****
-
- Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
- They can be run using *unittest* or *nosetest*:
-
- .. code-block:: console
-
- python -m unittest discover tests
- python3 -m unittest discover tests
- nosetests tests
-
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: Apache Software License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.0
-Classifier: Programming Language :: Python :: 3.1
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
+Metadata-Version: 1.1
+Name: jsonrpclib-pelix
+Version: 0.2.5
+Summary: This project is an implementation of the JSON-RPC v2.0 specification (backwards-compatible) as a client library, for Python 2.6+ and Python 3.This version is a fork of jsonrpclib by Josh Marshall, usable with Pelix remote services.
+Home-page: http://github.com/tcalmant/jsonrpclib/
+Author: Thomas Calmant
+Author-email: thomas.calmant+github@gmail.com
+License: Apache License 2.0
+Description: JSONRPClib (patched for Pelix)
+ ##############################
+
+ .. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
+ :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
+
+ .. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
+ :target: https://travis-ci.org/tcalmant/jsonrpclib
+
+ .. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
+ :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
+
+
+ This library is an implementation of the JSON-RPC specification.
+ It supports both the original 1.0 specification, as well as the
+ new (proposed) 2.0 specification, which includes batch submission, keyword
+ arguments, etc.
+
+ It is licensed under the Apache License, Version 2.0
+ (http://www.apache.org/licenses/LICENSE-2.0.html).
+
+
+ About this version
+ ******************
+
+ This is a patched version of the original ``jsonrpclib`` project by
+ Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
+
+ The suffix *-pelix* only indicates that this version works with Pelix Remote
+ Services, but it is **not** a Pelix specific implementation.
+
+ * This version adds support for Python 3, staying compatible with Python 2.
+ * It is now possible to use the dispatch_method argument while extending
+ the SimpleJSONRPCDispatcher, to use a custom dispatcher.
+ This allows to use this package by Pelix Remote Services.
+ * It can use thread pools to control the number of threads spawned to handle
+ notification requests and clients connections.
+ * The modifications added in other forks of this project have been added:
+
+ * From https://github.com/drdaeman/jsonrpclib:
+
+ * Improved JSON-RPC 1.0 support
+ * Less strict error response handling
+
+ * From https://github.com/tuomassalo/jsonrpclib:
+
+ * In case of a non-pre-defined error, raise an AppError and give access to
+ *error.data*
+
+ * From https://github.com/dejw/jsonrpclib:
+
+ * Custom headers can be sent with request and associated tests
+
+ * The support for Unix sockets has been removed, as it is not trivial to convert
+ to Python 3 (and I don't use them)
+ * This version cannot be installed with the original ``jsonrpclib``, as it uses
+ the same package name.
+
+
+ Summary
+ *******
+
+ This library implements the JSON-RPC 2.0 proposed specification in pure Python.
+ It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
+ (it extends where possible), so that projects using ``xmlrpclib`` could easily
+ be modified to use JSON and experiment with the differences.
+
+ It is backwards-compatible with the 1.0 specification, and supports all of the
+ new proposed features of 2.0, including:
+
+ * Batch submission (via MultiCall)
+ * Keyword arguments
+ * Notifications (both in a batch and 'normal')
+ * Class translation using the ``__jsonclass__`` key.
+
+ I've added a "SimpleJSONRPCServer", which is intended to emulate the
+ "SimpleXMLRPCServer" from the default Python distribution.
+
+
+ Requirements
+ ************
+
+ It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
+ order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
+ and then the ``simplejson`` external library).
+ One of these must be installed to use this library, although if you have a
+ standard distribution of 2.6+, you should already have one.
+ Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
+ you are going for full-on optimization you may want to pick it up.
+
+ Since library uses ``contextlib`` module, you should have at least Python 2.5
+ installed.
+
+
+ Installation
+ ************
+
+ You can install this from PyPI with one of the following commands (sudo
+ may be required):
+
+ .. code-block:: console
+
+ easy_install jsonrpclib-pelix
+ pip install jsonrpclib-pelix
+
+ Alternatively, you can download the source from the GitHub repository
+ at http://github.com/tcalmant/jsonrpclib and manually install it
+ with the following commands:
+
+ .. code-block:: console
+
+ git clone git://github.com/tcalmant/jsonrpclib.git
+ cd jsonrpclib
+ python setup.py install
+
+
+ SimpleJSONRPCServer
+ *******************
+
+ This is identical in usage (or should be) to the SimpleXMLRPCServer in the
+ Python standard library. Some of the differences in features are that it
+ obviously supports notification, batch calls, class translation (if left on),
+ etc.
+ Note: The import line is slightly different from the regular SimpleXMLRPCServer,
+ since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ server = SimpleJSONRPCServer(('localhost', 8080))
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+ server.serve_forever()
+
+ To start protect the server with SSL, use the following snippet:
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ # Setup the SSL socket
+ server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
+ server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
+ server_side=True)
+ server.server_bind()
+ server.server_activate()
+
+ # ... register functions
+ # Start the server
+ server.serve_forever()
+
+
+ Notification Thread Pool
+ ========================
+
+ By default, notification calls are handled in the request handling thread.
+ It is possible to use a thread pool to handle them, by giving it to the server
+ using the ``set_notification_pool()`` method:
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the thread pool: between 0 and 10 threads
+ pool = ThreadPool(max_threads=10, min_threads=0)
+
+ # Don't forget to start it
+ pool.start()
+
+ # Setup the server
+ server = SimpleJSONRPCServer(('localhost', 8080), config)
+ server.set_notification_pool(pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pool (let threads finish their current task)
+ pool.stop()
+ server.set_notification_pool(None)
+
+
+ Threaded server
+ ===============
+
+ It is also possible to use a thread pool to handle clients requests, using the
+ ``PooledJSONRPCServer`` class.
+ By default, this class uses pool of 0 to 30 threads. A custom pool can be given
+ with the ``thread_pool`` parameter of the class constructor.
+
+ The notification pool and the request pool are different: by default, a server
+ with a request pool doesn't have a notification pool.
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the notification and request pools
+ nofif_pool = ThreadPool(max_threads=10, min_threads=0)
+ request_pool = ThreadPool(max_threads=50, min_threads=10)
+
+ # Don't forget to start them
+ nofif_pool.start()
+ request_pool.start()
+
+ # Setup the server
+ server = PooledJSONRPCServer(('localhost', 8080), config,
+ thread_pool=request_pool)
+ server.set_notification_pool(nofif_pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pools (let threads finish their current task)
+ request_pool.stop()
+ nofif_pool.stop()
+ server.set_notification_pool(None)
+
+ Client Usage
+ ************
+
+ This is (obviously) taken from a console session.
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
+ >>> server.add(5,6)
+ 11
+ >>> server.add(x=5, y=10)
+ 15
+ >>> server._notify.add(5,6)
+ # No result returned...
+ >>> batch = jsonrpclib.MultiCall(server)
+ >>> batch.add(5, 6)
+ >>> batch.ping({'key':'value'})
+ >>> batch._notify.add(4, 30)
+ >>> results = batch()
+ >>> for result in results:
+ >>> ... print(result)
+ 11
+ {'key': 'value'}
+ # Note that there are only two responses -- this is according to spec.
+
+ # Clean up
+ >>> server('close')()
+
+ # Using client history
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
+ >>> server.add(5,6)
+ 11
+ >>> print(history.request)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "method": "add", "params": [5, 6]}
+ >>> print(history.response)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "result": 11}
+
+ # Clean up
+ >>> server('close')()
+
+ If you need 1.0 functionality, there are a bunch of places you can pass that in,
+ although the best is just to give a specific configuration to
+ ``jsonrpclib.ServerProxy``:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> jsonrpclib.config.DEFAULT.version
+ 2.0
+ >>> config = jsonrpclib.config.Config(version=1.0)
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
+ history=history)
+ >>> server.add(7, 10)
+ 17
+ >>> print(history.request)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
+ "method": "add", "params": [7, 10]}
+ >>> print(history.response)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
+ >>> server('close')()
+
+ The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
+ modifications. The ``dumps`` arguments are almost identical, but it adds three
+ arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
+ compatibility, and ``notify`` if it's a request that you want to be a
+ notification.
+
+ Additionally, the ``loads`` method does not return the params and method like
+ ``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
+ b.) returns the entire structure of the request / response for manual parsing.
+
+
+ Additional headers
+ ******************
+
+ If your remote service requires custom headers in request, you can pass them
+ as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
+ headers={'X-Test' : 'Test'})
+
+ You can also put additional request headers only for certain method invocation:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.Server("http://localhost:8080")
+ >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
+ ... test_server.ping(42)
+ ...
+ >>> # X-Test header will be no longer sent in requests
+
+ Of course ``_additional_headers`` contexts can be nested as well.
+
+
+ Class Translation
+ *****************
+
+ I've recently added "automatic" class translation support, although it is
+ turned off by default. This can be devastatingly slow if improperly used, so
+ the following is just a short list of things to keep in mind when using it.
+
+ * Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
+ * Do not require init params (for exceptions, keep reading)
+ * Getter properties without setters could be dangerous (read: not tested)
+
+ If any of the above are issues, use the _serialize method. (see usage below)
+ The server and client must BOTH have use_jsonclass configuration item on and
+ they must both have access to the same libraries used by the objects for
+ this to work.
+
+ If you have excessively nested arguments, it would be better to turn off the
+ translation and manually invoke it on specific objects using
+ ``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
+ behavior recursively goes through attributes and lists / dicts / tuples).
+
+ Sample file: *test_obj.py*
+
+ .. code-block:: python
+
+ # This object is /very/ simple, and the system will look through the
+ # attributes and serialize what it can.
+ class TestObj(object):
+ foo = 'bar'
+
+ # This object requires __init__ params, so it uses the _serialize method
+ # and returns a tuple of init params and attribute values (the init params
+ # can be a dict or a list, but the attribute values must be a dict.)
+ class TestSerial(object):
+ foo = 'bar'
+ def __init__(self, *args):
+ self.args = args
+ def _serialize(self):
+ return (self.args, {'foo':self.foo,})
+
+ * Sample usage
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> import test_obj
+
+ # History is used only to print the serialized form of beans
+ >>> history = jsonrpclib.history.History()
+ >>> testobj1 = test_obj.TestObj()
+ >>> testobj2 = test_obj.TestSerial()
+ >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
+
+ # The 'ping' just returns whatever is sent
+ >>> ping1 = server.ping(testobj1)
+ >>> ping2 = server.ping(testobj2)
+
+ >>> print(history.request)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "method": "ping", "params": [{"__jsonclass__":
+ ["test_obj.TestSerial", []], "foo": "bar"}
+ ]}
+ >>> print(history.response)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
+
+ This behavior is turned by default. To deactivate it, just set the
+ ``use_jsonclass`` member of a server ``Config`` to False.
+ If you want to use a per-class serialization method, set its name in the
+ ``serialize_method`` member of a server ``Config``.
+ Finally, if you are using classes that you have defined in the implementation
+ (as in, not a separate library), you'll need to add those (on BOTH the server
+ and the client) using the ``config.classes.add()`` method.
+
+ Feedback on this "feature" is very, VERY much appreciated.
+
+ Why JSON-RPC?
+ *************
+
+ In my opinion, there are several reasons to choose JSON over XML for RPC:
+
+ * Much simpler to read (I suppose this is opinion, but I know I'm right. :)
+ * Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
+ * Parsing - JSON should be much quicker to parse than XML.
+ * Easy class passing with ``jsonclass`` (when enabled)
+
+ In the interest of being fair, there are also a few reasons to choose XML
+ over JSON:
+
+ * Your server doesn't do JSON (rather obvious)
+ * Wider XML-RPC support across APIs (can we change this? :))
+ * Libraries are more established, i.e. more stable (Let's change this too.)
+
+ Tests
+ *****
+
+ Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
+ They can be run using *unittest* or *nosetest*:
+
+ .. code-block:: console
+
+ python -m unittest discover tests
+ python3 -m unittest discover tests
+ nosetests tests
+
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.0
+Classifier: Programming Language :: Python :: 3.1
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/README.rst b/external_libs/python/jsonrpclib-pelix-0.2.5/README.rst
index 29da2708..19001933 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/README.rst
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/README.rst
@@ -1,438 +1,438 @@
-JSONRPClib (patched for Pelix)
-##############################
-
-.. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
- :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
-
-.. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
- :target: https://travis-ci.org/tcalmant/jsonrpclib
-
-.. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
- :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
-
-
-This library is an implementation of the JSON-RPC specification.
-It supports both the original 1.0 specification, as well as the
-new (proposed) 2.0 specification, which includes batch submission, keyword
-arguments, etc.
-
-It is licensed under the Apache License, Version 2.0
-(http://www.apache.org/licenses/LICENSE-2.0.html).
-
-
-About this version
-******************
-
-This is a patched version of the original ``jsonrpclib`` project by
-Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
-
-The suffix *-pelix* only indicates that this version works with Pelix Remote
-Services, but it is **not** a Pelix specific implementation.
-
-* This version adds support for Python 3, staying compatible with Python 2.
-* It is now possible to use the dispatch_method argument while extending
- the SimpleJSONRPCDispatcher, to use a custom dispatcher.
- This allows to use this package by Pelix Remote Services.
-* It can use thread pools to control the number of threads spawned to handle
- notification requests and clients connections.
-* The modifications added in other forks of this project have been added:
-
- * From https://github.com/drdaeman/jsonrpclib:
-
- * Improved JSON-RPC 1.0 support
- * Less strict error response handling
-
- * From https://github.com/tuomassalo/jsonrpclib:
-
- * In case of a non-pre-defined error, raise an AppError and give access to
- *error.data*
-
- * From https://github.com/dejw/jsonrpclib:
-
- * Custom headers can be sent with request and associated tests
-
-* The support for Unix sockets has been removed, as it is not trivial to convert
- to Python 3 (and I don't use them)
-* This version cannot be installed with the original ``jsonrpclib``, as it uses
- the same package name.
-
-
-Summary
-*******
-
-This library implements the JSON-RPC 2.0 proposed specification in pure Python.
-It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
-(it extends where possible), so that projects using ``xmlrpclib`` could easily
-be modified to use JSON and experiment with the differences.
-
-It is backwards-compatible with the 1.0 specification, and supports all of the
-new proposed features of 2.0, including:
-
-* Batch submission (via MultiCall)
-* Keyword arguments
-* Notifications (both in a batch and 'normal')
-* Class translation using the ``__jsonclass__`` key.
-
-I've added a "SimpleJSONRPCServer", which is intended to emulate the
-"SimpleXMLRPCServer" from the default Python distribution.
-
-
-Requirements
-************
-
-It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
-order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
-and then the ``simplejson`` external library).
-One of these must be installed to use this library, although if you have a
-standard distribution of 2.6+, you should already have one.
-Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
-you are going for full-on optimization you may want to pick it up.
-
-Since library uses ``contextlib`` module, you should have at least Python 2.5
-installed.
-
-
-Installation
-************
-
-You can install this from PyPI with one of the following commands (sudo
-may be required):
-
-.. code-block:: console
-
- easy_install jsonrpclib-pelix
- pip install jsonrpclib-pelix
-
-Alternatively, you can download the source from the GitHub repository
-at http://github.com/tcalmant/jsonrpclib and manually install it
-with the following commands:
-
-.. code-block:: console
-
- git clone git://github.com/tcalmant/jsonrpclib.git
- cd jsonrpclib
- python setup.py install
-
-
-SimpleJSONRPCServer
-*******************
-
-This is identical in usage (or should be) to the SimpleXMLRPCServer in the
-Python standard library. Some of the differences in features are that it
-obviously supports notification, batch calls, class translation (if left on),
-etc.
-Note: The import line is slightly different from the regular SimpleXMLRPCServer,
-since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
-
-.. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- server = SimpleJSONRPCServer(('localhost', 8080))
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
- server.serve_forever()
-
-To start protect the server with SSL, use the following snippet:
-
-.. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- # Setup the SSL socket
- server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
- server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
- server_side=True)
- server.server_bind()
- server.server_activate()
-
- # ... register functions
- # Start the server
- server.serve_forever()
-
-
-Notification Thread Pool
-========================
-
-By default, notification calls are handled in the request handling thread.
-It is possible to use a thread pool to handle them, by giving it to the server
-using the ``set_notification_pool()`` method:
-
-.. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the thread pool: between 0 and 10 threads
- pool = ThreadPool(max_threads=10, min_threads=0)
-
- # Don't forget to start it
- pool.start()
-
- # Setup the server
- server = SimpleJSONRPCServer(('localhost', 8080), config)
- server.set_notification_pool(pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pool (let threads finish their current task)
- pool.stop()
- server.set_notification_pool(None)
-
-
-Threaded server
-===============
-
-It is also possible to use a thread pool to handle clients requests, using the
-``PooledJSONRPCServer`` class.
-By default, this class uses pool of 0 to 30 threads. A custom pool can be given
-with the ``thread_pool`` parameter of the class constructor.
-
-The notification pool and the request pool are different: by default, a server
-with a request pool doesn't have a notification pool.
-
-.. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the notification and request pools
- nofif_pool = ThreadPool(max_threads=10, min_threads=0)
- request_pool = ThreadPool(max_threads=50, min_threads=10)
-
- # Don't forget to start them
- nofif_pool.start()
- request_pool.start()
-
- # Setup the server
- server = PooledJSONRPCServer(('localhost', 8080), config,
- thread_pool=request_pool)
- server.set_notification_pool(nofif_pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pools (let threads finish their current task)
- request_pool.stop()
- nofif_pool.stop()
- server.set_notification_pool(None)
-
-Client Usage
-************
-
-This is (obviously) taken from a console session.
-
-.. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
- >>> server.add(5,6)
- 11
- >>> server.add(x=5, y=10)
- 15
- >>> server._notify.add(5,6)
- # No result returned...
- >>> batch = jsonrpclib.MultiCall(server)
- >>> batch.add(5, 6)
- >>> batch.ping({'key':'value'})
- >>> batch._notify.add(4, 30)
- >>> results = batch()
- >>> for result in results:
- >>> ... print(result)
- 11
- {'key': 'value'}
- # Note that there are only two responses -- this is according to spec.
-
- # Clean up
- >>> server('close')()
-
- # Using client history
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
- >>> server.add(5,6)
- 11
- >>> print(history.request)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "method": "add", "params": [5, 6]}
- >>> print(history.response)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "result": 11}
-
- # Clean up
- >>> server('close')()
-
-If you need 1.0 functionality, there are a bunch of places you can pass that in,
-although the best is just to give a specific configuration to
-``jsonrpclib.ServerProxy``:
-
-.. code-block:: python
-
- >>> import jsonrpclib
- >>> jsonrpclib.config.DEFAULT.version
- 2.0
- >>> config = jsonrpclib.config.Config(version=1.0)
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
- history=history)
- >>> server.add(7, 10)
- 17
- >>> print(history.request)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
- "method": "add", "params": [7, 10]}
- >>> print(history.response)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
- >>> server('close')()
-
-The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
-modifications. The ``dumps`` arguments are almost identical, but it adds three
-arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
-compatibility, and ``notify`` if it's a request that you want to be a
-notification.
-
-Additionally, the ``loads`` method does not return the params and method like
-``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
-b.) returns the entire structure of the request / response for manual parsing.
-
-
-Additional headers
-******************
-
-If your remote service requires custom headers in request, you can pass them
-as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
-
-.. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
- headers={'X-Test' : 'Test'})
-
-You can also put additional request headers only for certain method invocation:
-
-.. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.Server("http://localhost:8080")
- >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
- ... test_server.ping(42)
- ...
- >>> # X-Test header will be no longer sent in requests
-
-Of course ``_additional_headers`` contexts can be nested as well.
-
-
-Class Translation
-*****************
-
-I've recently added "automatic" class translation support, although it is
-turned off by default. This can be devastatingly slow if improperly used, so
-the following is just a short list of things to keep in mind when using it.
-
-* Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
-* Do not require init params (for exceptions, keep reading)
-* Getter properties without setters could be dangerous (read: not tested)
-
-If any of the above are issues, use the _serialize method. (see usage below)
-The server and client must BOTH have use_jsonclass configuration item on and
-they must both have access to the same libraries used by the objects for
-this to work.
-
-If you have excessively nested arguments, it would be better to turn off the
-translation and manually invoke it on specific objects using
-``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
-behavior recursively goes through attributes and lists / dicts / tuples).
-
- Sample file: *test_obj.py*
-
-.. code-block:: python
-
- # This object is /very/ simple, and the system will look through the
- # attributes and serialize what it can.
- class TestObj(object):
- foo = 'bar'
-
- # This object requires __init__ params, so it uses the _serialize method
- # and returns a tuple of init params and attribute values (the init params
- # can be a dict or a list, but the attribute values must be a dict.)
- class TestSerial(object):
- foo = 'bar'
- def __init__(self, *args):
- self.args = args
- def _serialize(self):
- return (self.args, {'foo':self.foo,})
-
-* Sample usage
-
-.. code-block:: python
-
- >>> import jsonrpclib
- >>> import test_obj
-
- # History is used only to print the serialized form of beans
- >>> history = jsonrpclib.history.History()
- >>> testobj1 = test_obj.TestObj()
- >>> testobj2 = test_obj.TestSerial()
- >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
-
- # The 'ping' just returns whatever is sent
- >>> ping1 = server.ping(testobj1)
- >>> ping2 = server.ping(testobj2)
-
- >>> print(history.request)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "method": "ping", "params": [{"__jsonclass__":
- ["test_obj.TestSerial", []], "foo": "bar"}
- ]}
- >>> print(history.response)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
-
-This behavior is turned by default. To deactivate it, just set the
-``use_jsonclass`` member of a server ``Config`` to False.
-If you want to use a per-class serialization method, set its name in the
-``serialize_method`` member of a server ``Config``.
-Finally, if you are using classes that you have defined in the implementation
-(as in, not a separate library), you'll need to add those (on BOTH the server
-and the client) using the ``config.classes.add()`` method.
-
-Feedback on this "feature" is very, VERY much appreciated.
-
-Why JSON-RPC?
-*************
-
-In my opinion, there are several reasons to choose JSON over XML for RPC:
-
-* Much simpler to read (I suppose this is opinion, but I know I'm right. :)
-* Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
-* Parsing - JSON should be much quicker to parse than XML.
-* Easy class passing with ``jsonclass`` (when enabled)
-
-In the interest of being fair, there are also a few reasons to choose XML
-over JSON:
-
-* Your server doesn't do JSON (rather obvious)
-* Wider XML-RPC support across APIs (can we change this? :))
-* Libraries are more established, i.e. more stable (Let's change this too.)
-
-Tests
-*****
-
-Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
-They can be run using *unittest* or *nosetest*:
-
-.. code-block:: console
-
- python -m unittest discover tests
- python3 -m unittest discover tests
- nosetests tests
+JSONRPClib (patched for Pelix)
+##############################
+
+.. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
+ :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
+
+.. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
+ :target: https://travis-ci.org/tcalmant/jsonrpclib
+
+.. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
+ :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
+
+
+This library is an implementation of the JSON-RPC specification.
+It supports both the original 1.0 specification, as well as the
+new (proposed) 2.0 specification, which includes batch submission, keyword
+arguments, etc.
+
+It is licensed under the Apache License, Version 2.0
+(http://www.apache.org/licenses/LICENSE-2.0.html).
+
+
+About this version
+******************
+
+This is a patched version of the original ``jsonrpclib`` project by
+Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
+
+The suffix *-pelix* only indicates that this version works with Pelix Remote
+Services, but it is **not** a Pelix specific implementation.
+
+* This version adds support for Python 3, staying compatible with Python 2.
+* It is now possible to use the dispatch_method argument while extending
+ the SimpleJSONRPCDispatcher, to use a custom dispatcher.
+ This allows to use this package by Pelix Remote Services.
+* It can use thread pools to control the number of threads spawned to handle
+ notification requests and clients connections.
+* The modifications added in other forks of this project have been added:
+
+ * From https://github.com/drdaeman/jsonrpclib:
+
+ * Improved JSON-RPC 1.0 support
+ * Less strict error response handling
+
+ * From https://github.com/tuomassalo/jsonrpclib:
+
+ * In case of a non-pre-defined error, raise an AppError and give access to
+ *error.data*
+
+ * From https://github.com/dejw/jsonrpclib:
+
+ * Custom headers can be sent with request and associated tests
+
+* The support for Unix sockets has been removed, as it is not trivial to convert
+ to Python 3 (and I don't use them)
+* This version cannot be installed with the original ``jsonrpclib``, as it uses
+ the same package name.
+
+
+Summary
+*******
+
+This library implements the JSON-RPC 2.0 proposed specification in pure Python.
+It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
+(it extends where possible), so that projects using ``xmlrpclib`` could easily
+be modified to use JSON and experiment with the differences.
+
+It is backwards-compatible with the 1.0 specification, and supports all of the
+new proposed features of 2.0, including:
+
+* Batch submission (via MultiCall)
+* Keyword arguments
+* Notifications (both in a batch and 'normal')
+* Class translation using the ``__jsonclass__`` key.
+
+I've added a "SimpleJSONRPCServer", which is intended to emulate the
+"SimpleXMLRPCServer" from the default Python distribution.
+
+
+Requirements
+************
+
+It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
+order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
+and then the ``simplejson`` external library).
+One of these must be installed to use this library, although if you have a
+standard distribution of 2.6+, you should already have one.
+Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
+you are going for full-on optimization you may want to pick it up.
+
+Since library uses ``contextlib`` module, you should have at least Python 2.5
+installed.
+
+
+Installation
+************
+
+You can install this from PyPI with one of the following commands (sudo
+may be required):
+
+.. code-block:: console
+
+ easy_install jsonrpclib-pelix
+ pip install jsonrpclib-pelix
+
+Alternatively, you can download the source from the GitHub repository
+at http://github.com/tcalmant/jsonrpclib and manually install it
+with the following commands:
+
+.. code-block:: console
+
+ git clone git://github.com/tcalmant/jsonrpclib.git
+ cd jsonrpclib
+ python setup.py install
+
+
+SimpleJSONRPCServer
+*******************
+
+This is identical in usage (or should be) to the SimpleXMLRPCServer in the
+Python standard library. Some of the differences in features are that it
+obviously supports notification, batch calls, class translation (if left on),
+etc.
+Note: The import line is slightly different from the regular SimpleXMLRPCServer,
+since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
+
+.. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ server = SimpleJSONRPCServer(('localhost', 8080))
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+ server.serve_forever()
+
+To start protect the server with SSL, use the following snippet:
+
+.. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ # Setup the SSL socket
+ server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
+ server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
+ server_side=True)
+ server.server_bind()
+ server.server_activate()
+
+ # ... register functions
+ # Start the server
+ server.serve_forever()
+
+
+Notification Thread Pool
+========================
+
+By default, notification calls are handled in the request handling thread.
+It is possible to use a thread pool to handle them, by giving it to the server
+using the ``set_notification_pool()`` method:
+
+.. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the thread pool: between 0 and 10 threads
+ pool = ThreadPool(max_threads=10, min_threads=0)
+
+ # Don't forget to start it
+ pool.start()
+
+ # Setup the server
+ server = SimpleJSONRPCServer(('localhost', 8080), config)
+ server.set_notification_pool(pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pool (let threads finish their current task)
+ pool.stop()
+ server.set_notification_pool(None)
+
+
+Threaded server
+===============
+
+It is also possible to use a thread pool to handle clients requests, using the
+``PooledJSONRPCServer`` class.
+By default, this class uses pool of 0 to 30 threads. A custom pool can be given
+with the ``thread_pool`` parameter of the class constructor.
+
+The notification pool and the request pool are different: by default, a server
+with a request pool doesn't have a notification pool.
+
+.. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the notification and request pools
+ nofif_pool = ThreadPool(max_threads=10, min_threads=0)
+ request_pool = ThreadPool(max_threads=50, min_threads=10)
+
+ # Don't forget to start them
+ nofif_pool.start()
+ request_pool.start()
+
+ # Setup the server
+ server = PooledJSONRPCServer(('localhost', 8080), config,
+ thread_pool=request_pool)
+ server.set_notification_pool(nofif_pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pools (let threads finish their current task)
+ request_pool.stop()
+ nofif_pool.stop()
+ server.set_notification_pool(None)
+
+Client Usage
+************
+
+This is (obviously) taken from a console session.
+
+.. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
+ >>> server.add(5,6)
+ 11
+ >>> server.add(x=5, y=10)
+ 15
+ >>> server._notify.add(5,6)
+ # No result returned...
+ >>> batch = jsonrpclib.MultiCall(server)
+ >>> batch.add(5, 6)
+ >>> batch.ping({'key':'value'})
+ >>> batch._notify.add(4, 30)
+ >>> results = batch()
+ >>> for result in results:
+ >>> ... print(result)
+ 11
+ {'key': 'value'}
+ # Note that there are only two responses -- this is according to spec.
+
+ # Clean up
+ >>> server('close')()
+
+ # Using client history
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
+ >>> server.add(5,6)
+ 11
+ >>> print(history.request)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "method": "add", "params": [5, 6]}
+ >>> print(history.response)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "result": 11}
+
+ # Clean up
+ >>> server('close')()
+
+If you need 1.0 functionality, there are a bunch of places you can pass that in,
+although the best is just to give a specific configuration to
+``jsonrpclib.ServerProxy``:
+
+.. code-block:: python
+
+ >>> import jsonrpclib
+ >>> jsonrpclib.config.DEFAULT.version
+ 2.0
+ >>> config = jsonrpclib.config.Config(version=1.0)
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
+ history=history)
+ >>> server.add(7, 10)
+ 17
+ >>> print(history.request)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
+ "method": "add", "params": [7, 10]}
+ >>> print(history.response)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
+ >>> server('close')()
+
+The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
+modifications. The ``dumps`` arguments are almost identical, but it adds three
+arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
+compatibility, and ``notify`` if it's a request that you want to be a
+notification.
+
+Additionally, the ``loads`` method does not return the params and method like
+``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
+b.) returns the entire structure of the request / response for manual parsing.
+
+
+Additional headers
+******************
+
+If your remote service requires custom headers in request, you can pass them
+as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
+
+.. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
+ headers={'X-Test' : 'Test'})
+
+You can also put additional request headers only for certain method invocation:
+
+.. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.Server("http://localhost:8080")
+ >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
+ ... test_server.ping(42)
+ ...
+ >>> # X-Test header will be no longer sent in requests
+
+Of course ``_additional_headers`` contexts can be nested as well.
+
+
+Class Translation
+*****************
+
+I've recently added "automatic" class translation support, although it is
+turned off by default. This can be devastatingly slow if improperly used, so
+the following is just a short list of things to keep in mind when using it.
+
+* Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
+* Do not require init params (for exceptions, keep reading)
+* Getter properties without setters could be dangerous (read: not tested)
+
+If any of the above are issues, use the _serialize method. (see usage below)
+The server and client must BOTH have use_jsonclass configuration item on and
+they must both have access to the same libraries used by the objects for
+this to work.
+
+If you have excessively nested arguments, it would be better to turn off the
+translation and manually invoke it on specific objects using
+``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
+behavior recursively goes through attributes and lists / dicts / tuples).
+
+ Sample file: *test_obj.py*
+
+.. code-block:: python
+
+ # This object is /very/ simple, and the system will look through the
+ # attributes and serialize what it can.
+ class TestObj(object):
+ foo = 'bar'
+
+ # This object requires __init__ params, so it uses the _serialize method
+ # and returns a tuple of init params and attribute values (the init params
+ # can be a dict or a list, but the attribute values must be a dict.)
+ class TestSerial(object):
+ foo = 'bar'
+ def __init__(self, *args):
+ self.args = args
+ def _serialize(self):
+ return (self.args, {'foo':self.foo,})
+
+* Sample usage
+
+.. code-block:: python
+
+ >>> import jsonrpclib
+ >>> import test_obj
+
+ # History is used only to print the serialized form of beans
+ >>> history = jsonrpclib.history.History()
+ >>> testobj1 = test_obj.TestObj()
+ >>> testobj2 = test_obj.TestSerial()
+ >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
+
+ # The 'ping' just returns whatever is sent
+ >>> ping1 = server.ping(testobj1)
+ >>> ping2 = server.ping(testobj2)
+
+ >>> print(history.request)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "method": "ping", "params": [{"__jsonclass__":
+ ["test_obj.TestSerial", []], "foo": "bar"}
+ ]}
+ >>> print(history.response)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
+
+This behavior is turned by default. To deactivate it, just set the
+``use_jsonclass`` member of a server ``Config`` to False.
+If you want to use a per-class serialization method, set its name in the
+``serialize_method`` member of a server ``Config``.
+Finally, if you are using classes that you have defined in the implementation
+(as in, not a separate library), you'll need to add those (on BOTH the server
+and the client) using the ``config.classes.add()`` method.
+
+Feedback on this "feature" is very, VERY much appreciated.
+
+Why JSON-RPC?
+*************
+
+In my opinion, there are several reasons to choose JSON over XML for RPC:
+
+* Much simpler to read (I suppose this is opinion, but I know I'm right. :)
+* Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
+* Parsing - JSON should be much quicker to parse than XML.
+* Easy class passing with ``jsonclass`` (when enabled)
+
+In the interest of being fair, there are also a few reasons to choose XML
+over JSON:
+
+* Your server doesn't do JSON (rather obvious)
+* Wider XML-RPC support across APIs (can we change this? :))
+* Libraries are more established, i.e. more stable (Let's change this too.)
+
+Tests
+*****
+
+Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
+They can be run using *unittest* or *nosetest*:
+
+.. code-block:: console
+
+ python -m unittest discover tests
+ python3 -m unittest discover tests
+ nosetests tests
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py
index f7a7b652..e9fe4e68 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/SimpleJSONRPCServer.py
@@ -1,602 +1,602 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-Defines a request dispatcher, a HTTP request handler, a HTTP server and a
-CGI request handler.
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-# Local modules
-from jsonrpclib import Fault
-import jsonrpclib.config
-import jsonrpclib.utils as utils
-import jsonrpclib.threadpool
-
-# Standard library
-import logging
-import socket
-import sys
-import traceback
-
-# Prepare the logger
-_logger = logging.getLogger(__name__)
-
-try:
- # Python 3
- # pylint: disable=F0401,E0611
- import xmlrpc.server as xmlrpcserver
- import socketserver
-except (ImportError, AttributeError):
- # Python 2 or IronPython
- # pylint: disable=F0401,E0611
- import SimpleXMLRPCServer as xmlrpcserver
- import SocketServer as socketserver
-
-try:
- # Windows
- import fcntl
-except ImportError:
- # Other systems
- # pylint: disable=C0103
- fcntl = None
-
-# ------------------------------------------------------------------------------
-
-
-def get_version(request):
- """
- Computes the JSON-RPC version
-
- :param request: A request dictionary
- :return: The JSON-RPC version or None
- """
- if 'jsonrpc' in request:
- return 2.0
- elif 'id' in request:
- return 1.0
-
- return None
-
-
-def validate_request(request, json_config):
- """
- Validates the format of a request dictionary
-
- :param request: A request dictionary
- :param json_config: A JSONRPClib Config instance
- :return: True if the dictionary is valid, else a Fault object
- """
- if not isinstance(request, utils.DictType):
- # Invalid request type
- fault = Fault(-32600, 'Request must be a dict, not {0}'
- .format(type(request).__name__),
- config=json_config)
- _logger.warning("Invalid request content: %s", fault)
- return fault
-
- # Get the request ID
- rpcid = request.get('id', None)
-
- # Check request version
- version = get_version(request)
- if not version:
- fault = Fault(-32600, 'Request {0} invalid.'.format(request),
- rpcid=rpcid, config=json_config)
- _logger.warning("No version in request: %s", fault)
- return fault
-
- # Default parameters: empty list
- request.setdefault('params', [])
-
- # Check parameters
- method = request.get('method', None)
- params = request.get('params')
- param_types = (utils.ListType, utils.DictType, utils.TupleType)
-
- if not method or not isinstance(method, utils.string_types) or \
- not isinstance(params, param_types):
- # Invalid type of method name or parameters
- fault = Fault(-32600, 'Invalid request parameters or method.',
- rpcid=rpcid, config=json_config)
- _logger.warning("Invalid request content: %s", fault)
- return fault
-
- # Valid request
- return True
-
-# ------------------------------------------------------------------------------
-
-
-class NoMulticallResult(Exception):
- """
- No result in multicall
- """
- pass
-
-
-class SimpleJSONRPCDispatcher(xmlrpcserver.SimpleXMLRPCDispatcher, object):
- """
- Mix-in class that dispatches JSON-RPC requests.
-
- This class is used to register JSON-RPC method handlers
- and then to dispatch them. This class doesn't need to be
- instanced directly when used by SimpleJSONRPCServer.
- """
- def __init__(self, encoding=None, config=jsonrpclib.config.DEFAULT):
- """
- Sets up the dispatcher with the given encoding.
- None values are allowed.
- """
- xmlrpcserver.SimpleXMLRPCDispatcher.__init__(
- self, allow_none=True, encoding=encoding or "UTF-8")
- self.json_config = config
-
- # Notification thread pool
- self.__notification_pool = None
-
- def set_notification_pool(self, thread_pool):
- """
- Sets the thread pool to use to handle notifications
- """
- self.__notification_pool = thread_pool
-
- def _unmarshaled_dispatch(self, request, dispatch_method=None):
- """
- Loads the request dictionary (unmarshaled), calls the method(s)
- accordingly and returns a JSON-RPC dictionary (not marshaled)
-
- :param request: JSON-RPC request dictionary (or list of)
- :param dispatch_method: Custom dispatch method (for method resolution)
- :return: A JSON-RPC dictionary (or an array of) or None if the request
- was a notification
- :raise NoMulticallResult: No result in batch
- """
- if not request:
- # Invalid request dictionary
- fault = Fault(-32600, 'Request invalid -- no request data.',
- config=self.json_config)
- _logger.warning("Invalid request: %s", fault)
- return fault.dump()
-
- if isinstance(request, utils.ListType):
- # This SHOULD be a batch, by spec
- responses = []
- for req_entry in request:
- # Validate the request
- result = validate_request(req_entry, self.json_config)
- if isinstance(result, Fault):
- responses.append(result.dump())
- continue
-
- # Call the method
- resp_entry = self._marshaled_single_dispatch(req_entry,
- dispatch_method)
-
- # Store its result
- if isinstance(resp_entry, Fault):
- # pylint: disable=E1103
- responses.append(resp_entry.dump())
- elif resp_entry is not None:
- responses.append(resp_entry)
-
- if not responses:
- # No non-None result
- _logger.error("No result in Multicall")
- raise NoMulticallResult("No result")
-
- return responses
-
- else:
- # Single call
- result = validate_request(request, self.json_config)
- if isinstance(result, Fault):
- return result.dump()
-
- # Call the method
- response = self._marshaled_single_dispatch(request,
- dispatch_method)
- if isinstance(response, Fault):
- # pylint: disable=E1103
- return response.dump()
-
- return response
-
- def _marshaled_dispatch(self, data, dispatch_method=None, path=None):
- """
- Parses the request data (marshaled), calls method(s) and returns a
- JSON string (marshaled)
-
- :param data: A JSON request string
- :param dispatch_method: Custom dispatch method (for method resolution)
- :param path: Unused parameter, to keep compatibility with xmlrpclib
- :return: A JSON-RPC response string (marshaled)
- """
- # Parse the request
- try:
- request = jsonrpclib.loads(data, self.json_config)
- except Exception as ex:
- # Parsing/loading error
- fault = Fault(-32700, 'Request {0} invalid. ({1}:{2})'
- .format(data, type(ex).__name__, ex),
- config=self.json_config)
- _logger.warning("Error parsing request: %s", fault)
- return fault.response()
-
- # Get the response dictionary
- try:
- response = self._unmarshaled_dispatch(request, dispatch_method)
- if response is not None:
- # Compute the string representation of the dictionary/list
- return jsonrpclib.jdumps(response, self.encoding)
- else:
- # No result (notification)
- return ''
- except NoMulticallResult:
- # Return an empty string (jsonrpclib internal behaviour)
- return ''
-
- def _marshaled_single_dispatch(self, request, dispatch_method=None):
- """
- Dispatches a single method call
-
- :param request: A validated request dictionary
- :param dispatch_method: Custom dispatch method (for method resolution)
- :return: A JSON-RPC response dictionary, or None if it was a
- notification request
- """
- method = request.get('method')
- params = request.get('params')
-
- # Prepare a request-specific configuration
- if 'jsonrpc' not in request and self.json_config.version >= 2:
- # JSON-RPC 1.0 request on a JSON-RPC 2.0
- # => compatibility needed
- config = self.json_config.copy()
- config.version = 1.0
- else:
- # Keep server configuration as is
- config = self.json_config
-
- # Test if this is a notification request
- is_notification = 'id' not in request or request['id'] in (None, '')
- if is_notification and self.__notification_pool is not None:
- # Use the thread pool for notifications
- if dispatch_method is not None:
- self.__notification_pool.enqueue(dispatch_method,
- method, params)
- else:
- self.__notification_pool.enqueue(self._dispatch,
- method, params, config)
-
- # Return immediately
- return None
- else:
- # Synchronous call
- try:
- # Call the method
- if dispatch_method is not None:
- response = dispatch_method(method, params)
- else:
- response = self._dispatch(method, params, config)
- except Exception as ex:
- # Return a fault
- fault = Fault(-32603, '{0}:{1}'.format(type(ex).__name__, ex),
- config=config)
- _logger.error("Error calling method %s: %s", method, fault)
- return fault.dump()
-
- if is_notification:
- # It's a notification, no result needed
- # Do not use 'not id' as it might be the integer 0
- return None
-
- # Prepare a JSON-RPC dictionary
- try:
- return jsonrpclib.dump(response, rpcid=request['id'],
- is_response=True, config=config)
- except Exception as ex:
- # JSON conversion exception
- fault = Fault(-32603, '{0}:{1}'.format(type(ex).__name__, ex),
- config=config)
- _logger.error("Error preparing JSON-RPC result: %s", fault)
- return fault.dump()
-
- def _dispatch(self, method, params, config=None):
- """
- Default method resolver and caller
-
- :param method: Name of the method to call
- :param params: List of arguments to give to the method
- :param config: Request-specific configuration
- :return: The result of the method
- """
- config = config or self.json_config
-
- func = None
- try:
- # Look into registered methods
- func = self.funcs[method]
- except KeyError:
- if self.instance is not None:
- # Try with the registered instance
- try:
- # Instance has a custom dispatcher
- return getattr(self.instance, '_dispatch')(method, params)
- except AttributeError:
- # Resolve the method name in the instance
- try:
- func = xmlrpcserver.resolve_dotted_attribute(
- self.instance, method, True)
- except AttributeError:
- # Unknown method
- pass
-
- if func is not None:
- try:
- # Call the method
- if isinstance(params, utils.ListType):
- return func(*params)
- else:
- return func(**params)
- except TypeError as ex:
- # Maybe the parameters are wrong
- fault = Fault(-32602, 'Invalid parameters: {0}'.format(ex),
- config=config)
- _logger.warning("Invalid call parameters: %s", fault)
- return fault
- except:
- # Method exception
- err_lines = traceback.format_exc().splitlines()
- trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
- fault = Fault(-32603, 'Server error: {0}'.format(trace_string),
- config=config)
- _logger.exception("Server-side exception: %s", fault)
- return fault
- else:
- # Unknown method
- fault = Fault(-32601, 'Method {0} not supported.'.format(method),
- config=config)
- _logger.warning("Unknown method: %s", fault)
- return fault
-
-# ------------------------------------------------------------------------------
-
-
-class SimpleJSONRPCRequestHandler(xmlrpcserver.SimpleXMLRPCRequestHandler):
- """
- HTTP request handler.
-
- The server that receives the requests must have a json_config member,
- containing a JSONRPClib Config instance
- """
- def do_POST(self):
- """
- Handles POST requests
- """
- if not self.is_rpc_path_valid():
- self.report_404()
- return
-
- # Retrieve the configuration
- config = getattr(self.server, 'json_config', jsonrpclib.config.DEFAULT)
-
- try:
- # Read the request body
- max_chunk_size = 10 * 1024 * 1024
- size_remaining = int(self.headers["content-length"])
- chunks = []
- while size_remaining:
- chunk_size = min(size_remaining, max_chunk_size)
- raw_chunk = self.rfile.read(chunk_size)
- if not raw_chunk:
- break
- chunks.append(utils.from_bytes(raw_chunk))
- size_remaining -= len(chunks[-1])
- data = ''.join(chunks)
-
- try:
- # Decode content
- data = self.decode_request_content(data)
- if data is None:
- # Unknown encoding, response has been sent
- return
- except AttributeError:
- # Available since Python 2.7
- pass
-
- # Execute the method
- response = self.server._marshaled_dispatch(
- data, getattr(self, '_dispatch', None), self.path)
-
- # No exception: send a 200 OK
- self.send_response(200)
- except:
- # Exception: send 500 Server Error
- self.send_response(500)
- err_lines = traceback.format_exc().splitlines()
- trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
- fault = jsonrpclib.Fault(-32603, 'Server error: {0}'
- .format(trace_string), config=config)
- _logger.exception("Server-side error: %s", fault)
- response = fault.response()
-
- if response is None:
- # Avoid to send None
- response = ''
-
- # Convert the response to the valid string format
- response = utils.to_bytes(response)
-
- # Send it
- self.send_header("Content-type", config.content_type)
- self.send_header("Content-length", str(len(response)))
- self.end_headers()
- if response:
- self.wfile.write(response)
-
-# ------------------------------------------------------------------------------
-
-
-class SimpleJSONRPCServer(socketserver.TCPServer, SimpleJSONRPCDispatcher):
- """
- JSON-RPC server (and dispatcher)
- """
- # This simplifies server restart after error
- allow_reuse_address = True
-
- # pylint: disable=C0103
- def __init__(self, addr, requestHandler=SimpleJSONRPCRequestHandler,
- logRequests=True, encoding=None, bind_and_activate=True,
- address_family=socket.AF_INET,
- config=jsonrpclib.config.DEFAULT):
- """
- Sets up the server and the dispatcher
-
- :param addr: The server listening address
- :param requestHandler: Custom request handler
- :param logRequests: Flag to(de)activate requests logging
- :param encoding: The dispatcher request encoding
- :param bind_and_activate: If True, starts the server immediately
- :param address_family: The server listening address family
- :param config: A JSONRPClib Config instance
- """
- # Set up the dispatcher fields
- SimpleJSONRPCDispatcher.__init__(self, encoding, config)
-
- # Prepare the server configuration
- # logRequests is used by SimpleXMLRPCRequestHandler
- self.logRequests = logRequests
- self.address_family = address_family
- self.json_config = config
-
- # Work on the request handler
- class RequestHandlerWrapper(requestHandler, object):
- """
- Wraps the request handle to have access to the configuration
- """
- def __init__(self, *args, **kwargs):
- """
- Constructs the wrapper after having stored the configuration
- """
- self.config = config
- super(RequestHandlerWrapper, self).__init__(*args, **kwargs)
-
- # Set up the server
- socketserver.TCPServer.__init__(self, addr, requestHandler,
- bind_and_activate)
-
- # Windows-specific
- if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
- flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
- flags |= fcntl.FD_CLOEXEC
- fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
-
-# ------------------------------------------------------------------------------
-
-
-class PooledJSONRPCServer(SimpleJSONRPCServer, socketserver.ThreadingMixIn):
- """
- JSON-RPC server based on a thread pool
- """
- def __init__(self, addr, requestHandler=SimpleJSONRPCRequestHandler,
- logRequests=True, encoding=None, bind_and_activate=True,
- address_family=socket.AF_INET,
- config=jsonrpclib.config.DEFAULT, thread_pool=None):
- """
- Sets up the server and the dispatcher
-
- :param addr: The server listening address
- :param requestHandler: Custom request handler
- :param logRequests: Flag to(de)activate requests logging
- :param encoding: The dispatcher request encoding
- :param bind_and_activate: If True, starts the server immediately
- :param address_family: The server listening address family
- :param config: A JSONRPClib Config instance
- :param thread_pool: A ThreadPool object. The pool must be started.
- """
- # Normalize the thread pool
- if thread_pool is None:
- # Start a thread pool with 30 threads max, 0 thread min
- thread_pool = jsonrpclib.threadpool.ThreadPool(
- 30, 0, logname="PooledJSONRPCServer")
- thread_pool.start()
-
- # Store the thread pool
- self.__request_pool = thread_pool
-
- # Prepare the server
- SimpleJSONRPCServer.__init__(self, addr, requestHandler, logRequests,
- encoding, bind_and_activate,
- address_family, config)
-
- def process_request(self, request, client_address):
- """
- Handle a client request: queue it in the thread pool
- """
- self.__request_pool.enqueue(self.process_request_thread,
- request, client_address)
-
- def server_close(self):
- """
- Clean up the server
- """
- SimpleJSONRPCServer.server_close(self)
- self.__request_pool.stop()
-
-# ------------------------------------------------------------------------------
-
-
-class CGIJSONRPCRequestHandler(SimpleJSONRPCDispatcher):
- """
- JSON-RPC CGI handler (and dispatcher)
- """
- def __init__(self, encoding=None, config=jsonrpclib.config.DEFAULT):
- """
- Sets up the dispatcher
-
- :param encoding: Dispatcher encoding
- :param config: A JSONRPClib Config instance
- """
- SimpleJSONRPCDispatcher.__init__(self, encoding, config)
-
- def handle_jsonrpc(self, request_text):
- """
- Handle a JSON-RPC request
- """
- response = self._marshaled_dispatch(request_text)
- sys.stdout.write('Content-Type: {0}\r\n'
- .format(self.json_config.content_type))
- sys.stdout.write('Content-Length: {0:d}\r\n'.format(len(response)))
- sys.stdout.write('\r\n')
- sys.stdout.write(response)
-
- # XML-RPC alias
- handle_xmlrpc = handle_jsonrpc
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+Defines a request dispatcher, a HTTP request handler, a HTTP server and a
+CGI request handler.
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+# Local modules
+from jsonrpclib import Fault
+import jsonrpclib.config
+import jsonrpclib.utils as utils
+import jsonrpclib.threadpool
+
+# Standard library
+import logging
+import socket
+import sys
+import traceback
+
+# Prepare the logger
+_logger = logging.getLogger(__name__)
+
+try:
+ # Python 3
+ # pylint: disable=F0401,E0611
+ import xmlrpc.server as xmlrpcserver
+ import socketserver
+except (ImportError, AttributeError):
+ # Python 2 or IronPython
+ # pylint: disable=F0401,E0611
+ import SimpleXMLRPCServer as xmlrpcserver
+ import SocketServer as socketserver
+
+try:
+ # Windows
+ import fcntl
+except ImportError:
+ # Other systems
+ # pylint: disable=C0103
+ fcntl = None
+
+# ------------------------------------------------------------------------------
+
+
+def get_version(request):
+ """
+ Computes the JSON-RPC version
+
+ :param request: A request dictionary
+ :return: The JSON-RPC version or None
+ """
+ if 'jsonrpc' in request:
+ return 2.0
+ elif 'id' in request:
+ return 1.0
+
+ return None
+
+
+def validate_request(request, json_config):
+ """
+ Validates the format of a request dictionary
+
+ :param request: A request dictionary
+ :param json_config: A JSONRPClib Config instance
+ :return: True if the dictionary is valid, else a Fault object
+ """
+ if not isinstance(request, utils.DictType):
+ # Invalid request type
+ fault = Fault(-32600, 'Request must be a dict, not {0}'
+ .format(type(request).__name__),
+ config=json_config)
+ _logger.warning("Invalid request content: %s", fault)
+ return fault
+
+ # Get the request ID
+ rpcid = request.get('id', None)
+
+ # Check request version
+ version = get_version(request)
+ if not version:
+ fault = Fault(-32600, 'Request {0} invalid.'.format(request),
+ rpcid=rpcid, config=json_config)
+ _logger.warning("No version in request: %s", fault)
+ return fault
+
+ # Default parameters: empty list
+ request.setdefault('params', [])
+
+ # Check parameters
+ method = request.get('method', None)
+ params = request.get('params')
+ param_types = (utils.ListType, utils.DictType, utils.TupleType)
+
+ if not method or not isinstance(method, utils.string_types) or \
+ not isinstance(params, param_types):
+ # Invalid type of method name or parameters
+ fault = Fault(-32600, 'Invalid request parameters or method.',
+ rpcid=rpcid, config=json_config)
+ _logger.warning("Invalid request content: %s", fault)
+ return fault
+
+ # Valid request
+ return True
+
+# ------------------------------------------------------------------------------
+
+
+class NoMulticallResult(Exception):
+ """
+ No result in multicall
+ """
+ pass
+
+
+class SimpleJSONRPCDispatcher(xmlrpcserver.SimpleXMLRPCDispatcher, object):
+ """
+ Mix-in class that dispatches JSON-RPC requests.
+
+ This class is used to register JSON-RPC method handlers
+ and then to dispatch them. This class doesn't need to be
+ instanced directly when used by SimpleJSONRPCServer.
+ """
+ def __init__(self, encoding=None, config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the dispatcher with the given encoding.
+ None values are allowed.
+ """
+ xmlrpcserver.SimpleXMLRPCDispatcher.__init__(
+ self, allow_none=True, encoding=encoding or "UTF-8")
+ self.json_config = config
+
+ # Notification thread pool
+ self.__notification_pool = None
+
+ def set_notification_pool(self, thread_pool):
+ """
+ Sets the thread pool to use to handle notifications
+ """
+ self.__notification_pool = thread_pool
+
+ def _unmarshaled_dispatch(self, request, dispatch_method=None):
+ """
+ Loads the request dictionary (unmarshaled), calls the method(s)
+ accordingly and returns a JSON-RPC dictionary (not marshaled)
+
+ :param request: JSON-RPC request dictionary (or list of)
+ :param dispatch_method: Custom dispatch method (for method resolution)
+ :return: A JSON-RPC dictionary (or an array of) or None if the request
+ was a notification
+ :raise NoMulticallResult: No result in batch
+ """
+ if not request:
+ # Invalid request dictionary
+ fault = Fault(-32600, 'Request invalid -- no request data.',
+ config=self.json_config)
+ _logger.warning("Invalid request: %s", fault)
+ return fault.dump()
+
+ if isinstance(request, utils.ListType):
+ # This SHOULD be a batch, by spec
+ responses = []
+ for req_entry in request:
+ # Validate the request
+ result = validate_request(req_entry, self.json_config)
+ if isinstance(result, Fault):
+ responses.append(result.dump())
+ continue
+
+ # Call the method
+ resp_entry = self._marshaled_single_dispatch(req_entry,
+ dispatch_method)
+
+ # Store its result
+ if isinstance(resp_entry, Fault):
+ # pylint: disable=E1103
+ responses.append(resp_entry.dump())
+ elif resp_entry is not None:
+ responses.append(resp_entry)
+
+ if not responses:
+ # No non-None result
+ _logger.error("No result in Multicall")
+ raise NoMulticallResult("No result")
+
+ return responses
+
+ else:
+ # Single call
+ result = validate_request(request, self.json_config)
+ if isinstance(result, Fault):
+ return result.dump()
+
+ # Call the method
+ response = self._marshaled_single_dispatch(request,
+ dispatch_method)
+ if isinstance(response, Fault):
+ # pylint: disable=E1103
+ return response.dump()
+
+ return response
+
+ def _marshaled_dispatch(self, data, dispatch_method=None, path=None):
+ """
+ Parses the request data (marshaled), calls method(s) and returns a
+ JSON string (marshaled)
+
+ :param data: A JSON request string
+ :param dispatch_method: Custom dispatch method (for method resolution)
+ :param path: Unused parameter, to keep compatibility with xmlrpclib
+ :return: A JSON-RPC response string (marshaled)
+ """
+ # Parse the request
+ try:
+ request = jsonrpclib.loads(data, self.json_config)
+ except Exception as ex:
+ # Parsing/loading error
+ fault = Fault(-32700, 'Request {0} invalid. ({1}:{2})'
+ .format(data, type(ex).__name__, ex),
+ config=self.json_config)
+ _logger.warning("Error parsing request: %s", fault)
+ return fault.response()
+
+ # Get the response dictionary
+ try:
+ response = self._unmarshaled_dispatch(request, dispatch_method)
+ if response is not None:
+ # Compute the string representation of the dictionary/list
+ return jsonrpclib.jdumps(response, self.encoding)
+ else:
+ # No result (notification)
+ return ''
+ except NoMulticallResult:
+ # Return an empty string (jsonrpclib internal behaviour)
+ return ''
+
+ def _marshaled_single_dispatch(self, request, dispatch_method=None):
+ """
+ Dispatches a single method call
+
+ :param request: A validated request dictionary
+ :param dispatch_method: Custom dispatch method (for method resolution)
+ :return: A JSON-RPC response dictionary, or None if it was a
+ notification request
+ """
+ method = request.get('method')
+ params = request.get('params')
+
+ # Prepare a request-specific configuration
+ if 'jsonrpc' not in request and self.json_config.version >= 2:
+ # JSON-RPC 1.0 request on a JSON-RPC 2.0
+ # => compatibility needed
+ config = self.json_config.copy()
+ config.version = 1.0
+ else:
+ # Keep server configuration as is
+ config = self.json_config
+
+ # Test if this is a notification request
+ is_notification = 'id' not in request or request['id'] in (None, '')
+ if is_notification and self.__notification_pool is not None:
+ # Use the thread pool for notifications
+ if dispatch_method is not None:
+ self.__notification_pool.enqueue(dispatch_method,
+ method, params)
+ else:
+ self.__notification_pool.enqueue(self._dispatch,
+ method, params, config)
+
+ # Return immediately
+ return None
+ else:
+ # Synchronous call
+ try:
+ # Call the method
+ if dispatch_method is not None:
+ response = dispatch_method(method, params)
+ else:
+ response = self._dispatch(method, params, config)
+ except Exception as ex:
+ # Return a fault
+ fault = Fault(-32603, '{0}:{1}'.format(type(ex).__name__, ex),
+ config=config)
+ _logger.error("Error calling method %s: %s", method, fault)
+ return fault.dump()
+
+ if is_notification:
+ # It's a notification, no result needed
+ # Do not use 'not id' as it might be the integer 0
+ return None
+
+ # Prepare a JSON-RPC dictionary
+ try:
+ return jsonrpclib.dump(response, rpcid=request['id'],
+ is_response=True, config=config)
+ except Exception as ex:
+ # JSON conversion exception
+ fault = Fault(-32603, '{0}:{1}'.format(type(ex).__name__, ex),
+ config=config)
+ _logger.error("Error preparing JSON-RPC result: %s", fault)
+ return fault.dump()
+
+ def _dispatch(self, method, params, config=None):
+ """
+ Default method resolver and caller
+
+ :param method: Name of the method to call
+ :param params: List of arguments to give to the method
+ :param config: Request-specific configuration
+ :return: The result of the method
+ """
+ config = config or self.json_config
+
+ func = None
+ try:
+ # Look into registered methods
+ func = self.funcs[method]
+ except KeyError:
+ if self.instance is not None:
+ # Try with the registered instance
+ try:
+ # Instance has a custom dispatcher
+ return getattr(self.instance, '_dispatch')(method, params)
+ except AttributeError:
+ # Resolve the method name in the instance
+ try:
+ func = xmlrpcserver.resolve_dotted_attribute(
+ self.instance, method, True)
+ except AttributeError:
+ # Unknown method
+ pass
+
+ if func is not None:
+ try:
+ # Call the method
+ if isinstance(params, utils.ListType):
+ return func(*params)
+ else:
+ return func(**params)
+ except TypeError as ex:
+ # Maybe the parameters are wrong
+ fault = Fault(-32602, 'Invalid parameters: {0}'.format(ex),
+ config=config)
+ _logger.warning("Invalid call parameters: %s", fault)
+ return fault
+ except:
+ # Method exception
+ err_lines = traceback.format_exc().splitlines()
+ trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
+ fault = Fault(-32603, 'Server error: {0}'.format(trace_string),
+ config=config)
+ _logger.exception("Server-side exception: %s", fault)
+ return fault
+ else:
+ # Unknown method
+ fault = Fault(-32601, 'Method {0} not supported.'.format(method),
+ config=config)
+ _logger.warning("Unknown method: %s", fault)
+ return fault
+
+# ------------------------------------------------------------------------------
+
+
+class SimpleJSONRPCRequestHandler(xmlrpcserver.SimpleXMLRPCRequestHandler):
+ """
+ HTTP request handler.
+
+ The server that receives the requests must have a json_config member,
+ containing a JSONRPClib Config instance
+ """
+ def do_POST(self):
+ """
+ Handles POST requests
+ """
+ if not self.is_rpc_path_valid():
+ self.report_404()
+ return
+
+ # Retrieve the configuration
+ config = getattr(self.server, 'json_config', jsonrpclib.config.DEFAULT)
+
+ try:
+ # Read the request body
+ max_chunk_size = 10 * 1024 * 1024
+ size_remaining = int(self.headers["content-length"])
+ chunks = []
+ while size_remaining:
+ chunk_size = min(size_remaining, max_chunk_size)
+ raw_chunk = self.rfile.read(chunk_size)
+ if not raw_chunk:
+ break
+ chunks.append(utils.from_bytes(raw_chunk))
+ size_remaining -= len(chunks[-1])
+ data = ''.join(chunks)
+
+ try:
+ # Decode content
+ data = self.decode_request_content(data)
+ if data is None:
+ # Unknown encoding, response has been sent
+ return
+ except AttributeError:
+ # Available since Python 2.7
+ pass
+
+ # Execute the method
+ response = self.server._marshaled_dispatch(
+ data, getattr(self, '_dispatch', None), self.path)
+
+ # No exception: send a 200 OK
+ self.send_response(200)
+ except:
+ # Exception: send 500 Server Error
+ self.send_response(500)
+ err_lines = traceback.format_exc().splitlines()
+ trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
+ fault = jsonrpclib.Fault(-32603, 'Server error: {0}'
+ .format(trace_string), config=config)
+ _logger.exception("Server-side error: %s", fault)
+ response = fault.response()
+
+ if response is None:
+ # Avoid to send None
+ response = ''
+
+ # Convert the response to the valid string format
+ response = utils.to_bytes(response)
+
+ # Send it
+ self.send_header("Content-type", config.content_type)
+ self.send_header("Content-length", str(len(response)))
+ self.end_headers()
+ if response:
+ self.wfile.write(response)
+
+# ------------------------------------------------------------------------------
+
+
+class SimpleJSONRPCServer(socketserver.TCPServer, SimpleJSONRPCDispatcher):
+ """
+ JSON-RPC server (and dispatcher)
+ """
+ # This simplifies server restart after error
+ allow_reuse_address = True
+
+ # pylint: disable=C0103
+ def __init__(self, addr, requestHandler=SimpleJSONRPCRequestHandler,
+ logRequests=True, encoding=None, bind_and_activate=True,
+ address_family=socket.AF_INET,
+ config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the server and the dispatcher
+
+ :param addr: The server listening address
+ :param requestHandler: Custom request handler
+ :param logRequests: Flag to(de)activate requests logging
+ :param encoding: The dispatcher request encoding
+ :param bind_and_activate: If True, starts the server immediately
+ :param address_family: The server listening address family
+ :param config: A JSONRPClib Config instance
+ """
+ # Set up the dispatcher fields
+ SimpleJSONRPCDispatcher.__init__(self, encoding, config)
+
+ # Prepare the server configuration
+ # logRequests is used by SimpleXMLRPCRequestHandler
+ self.logRequests = logRequests
+ self.address_family = address_family
+ self.json_config = config
+
+ # Work on the request handler
+ class RequestHandlerWrapper(requestHandler, object):
+ """
+ Wraps the request handle to have access to the configuration
+ """
+ def __init__(self, *args, **kwargs):
+ """
+ Constructs the wrapper after having stored the configuration
+ """
+ self.config = config
+ super(RequestHandlerWrapper, self).__init__(*args, **kwargs)
+
+ # Set up the server
+ socketserver.TCPServer.__init__(self, addr, requestHandler,
+ bind_and_activate)
+
+ # Windows-specific
+ if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
+ flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+# ------------------------------------------------------------------------------
+
+
+class PooledJSONRPCServer(SimpleJSONRPCServer, socketserver.ThreadingMixIn):
+ """
+ JSON-RPC server based on a thread pool
+ """
+ def __init__(self, addr, requestHandler=SimpleJSONRPCRequestHandler,
+ logRequests=True, encoding=None, bind_and_activate=True,
+ address_family=socket.AF_INET,
+ config=jsonrpclib.config.DEFAULT, thread_pool=None):
+ """
+ Sets up the server and the dispatcher
+
+ :param addr: The server listening address
+ :param requestHandler: Custom request handler
+ :param logRequests: Flag to(de)activate requests logging
+ :param encoding: The dispatcher request encoding
+ :param bind_and_activate: If True, starts the server immediately
+ :param address_family: The server listening address family
+ :param config: A JSONRPClib Config instance
+ :param thread_pool: A ThreadPool object. The pool must be started.
+ """
+ # Normalize the thread pool
+ if thread_pool is None:
+ # Start a thread pool with 30 threads max, 0 thread min
+ thread_pool = jsonrpclib.threadpool.ThreadPool(
+ 30, 0, logname="PooledJSONRPCServer")
+ thread_pool.start()
+
+ # Store the thread pool
+ self.__request_pool = thread_pool
+
+ # Prepare the server
+ SimpleJSONRPCServer.__init__(self, addr, requestHandler, logRequests,
+ encoding, bind_and_activate,
+ address_family, config)
+
+ def process_request(self, request, client_address):
+ """
+ Handle a client request: queue it in the thread pool
+ """
+ self.__request_pool.enqueue(self.process_request_thread,
+ request, client_address)
+
+ def server_close(self):
+ """
+ Clean up the server
+ """
+ SimpleJSONRPCServer.server_close(self)
+ self.__request_pool.stop()
+
+# ------------------------------------------------------------------------------
+
+
+class CGIJSONRPCRequestHandler(SimpleJSONRPCDispatcher):
+ """
+ JSON-RPC CGI handler (and dispatcher)
+ """
+ def __init__(self, encoding=None, config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the dispatcher
+
+ :param encoding: Dispatcher encoding
+ :param config: A JSONRPClib Config instance
+ """
+ SimpleJSONRPCDispatcher.__init__(self, encoding, config)
+
+ def handle_jsonrpc(self, request_text):
+ """
+ Handle a JSON-RPC request
+ """
+ response = self._marshaled_dispatch(request_text)
+ sys.stdout.write('Content-Type: {0}\r\n'
+ .format(self.json_config.content_type))
+ sys.stdout.write('Content-Length: {0:d}\r\n'.format(len(response)))
+ sys.stdout.write('\r\n')
+ sys.stdout.write(response)
+
+ # XML-RPC alias
+ handle_xmlrpc = handle_jsonrpc
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py
index 2c7dc1c5..a92774ab 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/__init__.py
@@ -1,34 +1,34 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-Aliases to ease access to jsonrpclib classes
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Easy access to utility methods and classes
-from jsonrpclib.jsonrpc import Server, ServerProxy
-from jsonrpclib.jsonrpc import MultiCall, Fault, ProtocolError, AppError
-from jsonrpclib.jsonrpc import loads, dumps, load, dump
-from jsonrpclib.jsonrpc import jloads, jdumps
-import jsonrpclib.history as history
-import jsonrpclib.utils as utils
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+Aliases to ease access to jsonrpclib classes
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Easy access to utility methods and classes
+from jsonrpclib.jsonrpc import Server, ServerProxy
+from jsonrpclib.jsonrpc import MultiCall, Fault, ProtocolError, AppError
+from jsonrpclib.jsonrpc import loads, dumps, load, dump
+from jsonrpclib.jsonrpc import jloads, jdumps
+import jsonrpclib.history as history
+import jsonrpclib.utils as utils
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py
index d2c5a811..77838d4e 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/config.py
@@ -1,141 +1,141 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-The configuration module.
-
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-import sys
-
-# ------------------------------------------------------------------------------
-
-
-class LocalClasses(dict):
- """
- Associates local classes with their names (used in the jsonclass module)
- """
- def add(self, cls, name=None):
- """
- Stores a local class
-
- :param cls: A class
- :param name: Custom name used in the __jsonclass__ attribute
- """
- if not name:
- name = cls.__name__
- self[name] = cls
-
-# ------------------------------------------------------------------------------
-
-
-class Config(object):
- """
- This is pretty much used exclusively for the 'jsonclass'
- functionality... set use_jsonclass to False to turn it off.
- You can change serialize_method and ignore_attribute, or use
- the local_classes.add(class) to include "local" classes.
- """
- def __init__(self, version=2.0, content_type="application/json-rpc",
- user_agent=None, use_jsonclass=True,
- serialize_method='_serialize',
- ignore_attribute='_ignore',
- serialize_handlers=None):
- """
- Sets up a configuration of JSONRPClib
-
- :param version: JSON-RPC specification version
- :param content_type: HTTP content type header value
- :param user_agent: The HTTP request user agent
- :param use_jsonclass: Allow bean marshalling
- :param serialize_method: A string that references the method on a
- custom class object which is responsible for
- returning a tuple of the arguments and a dict
- of attributes.
- :param ignore_attribute: A string that references the attribute on a
- custom class object which holds strings and/or
- references of the attributes the class
- translator should ignore.
- :param serialize_handlers: A dictionary of dump handler functions by
- type for additional type support and for
- overriding dump of built-in types in utils
- """
- # JSON-RPC specification
- self.version = version
-
- # Change to False to keep __jsonclass__ entries raw.
- self.use_jsonclass = use_jsonclass
-
- # it SHOULD be 'application/json-rpc'
- # but MAY be 'application/json' or 'application/jsonrequest'
- self.content_type = content_type
-
- # Default user agent
- if user_agent is None:
- user_agent = 'jsonrpclib/{0} (Python {1})'.format(
- __version__, '.'.join(str(ver)
- for ver in sys.version_info[0:3]))
- self.user_agent = user_agent
-
- # The list of classes to use for jsonclass translation.
- self.classes = LocalClasses()
-
- # The serialize_method should be a string that references the
- # method on a custom class object which is responsible for
- # returning a tuple of the constructor arguments and a dict of
- # attributes.
- self.serialize_method = serialize_method
-
- # The ignore attribute should be a string that references the
- # attribute on a custom class object which holds strings and / or
- # references of the attributes the class translator should ignore.
- self.ignore_attribute = ignore_attribute
-
- # The list of serialize handler functions for jsonclass dump.
- # Used for handling additional types and overriding built-in types.
- # Functions are expected to have the same parameters as jsonclass dump
- # (possibility to call standard jsonclass dump function within).
- self.serialize_handlers = serialize_handlers or {}
-
- def copy(self):
- """
- Returns a shallow copy of this configuration bean
-
- :return: A shallow copy of this configuration
- """
- new_config = Config(self.version, self.content_type, self.user_agent,
- self.use_jsonclass, self.serialize_method,
- self.ignore_attribute, None)
- new_config.classes = self.classes.copy()
- new_config.serialize_handlers = self.serialize_handlers.copy()
- return new_config
-
-# Default configuration
-DEFAULT = Config()
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+The configuration module.
+
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+import sys
+
+# ------------------------------------------------------------------------------
+
+
+class LocalClasses(dict):
+ """
+ Associates local classes with their names (used in the jsonclass module)
+ """
+ def add(self, cls, name=None):
+ """
+ Stores a local class
+
+ :param cls: A class
+ :param name: Custom name used in the __jsonclass__ attribute
+ """
+ if not name:
+ name = cls.__name__
+ self[name] = cls
+
+# ------------------------------------------------------------------------------
+
+
+class Config(object):
+ """
+ This is pretty much used exclusively for the 'jsonclass'
+ functionality... set use_jsonclass to False to turn it off.
+ You can change serialize_method and ignore_attribute, or use
+ the local_classes.add(class) to include "local" classes.
+ """
+ def __init__(self, version=2.0, content_type="application/json-rpc",
+ user_agent=None, use_jsonclass=True,
+ serialize_method='_serialize',
+ ignore_attribute='_ignore',
+ serialize_handlers=None):
+ """
+ Sets up a configuration of JSONRPClib
+
+ :param version: JSON-RPC specification version
+ :param content_type: HTTP content type header value
+ :param user_agent: The HTTP request user agent
+ :param use_jsonclass: Allow bean marshalling
+ :param serialize_method: A string that references the method on a
+ custom class object which is responsible for
+ returning a tuple of the arguments and a dict
+ of attributes.
+ :param ignore_attribute: A string that references the attribute on a
+ custom class object which holds strings and/or
+ references of the attributes the class
+ translator should ignore.
+ :param serialize_handlers: A dictionary of dump handler functions by
+ type for additional type support and for
+ overriding dump of built-in types in utils
+ """
+ # JSON-RPC specification
+ self.version = version
+
+ # Change to False to keep __jsonclass__ entries raw.
+ self.use_jsonclass = use_jsonclass
+
+ # it SHOULD be 'application/json-rpc'
+ # but MAY be 'application/json' or 'application/jsonrequest'
+ self.content_type = content_type
+
+ # Default user agent
+ if user_agent is None:
+ user_agent = 'jsonrpclib/{0} (Python {1})'.format(
+ __version__, '.'.join(str(ver)
+ for ver in sys.version_info[0:3]))
+ self.user_agent = user_agent
+
+ # The list of classes to use for jsonclass translation.
+ self.classes = LocalClasses()
+
+ # The serialize_method should be a string that references the
+ # method on a custom class object which is responsible for
+ # returning a tuple of the constructor arguments and a dict of
+ # attributes.
+ self.serialize_method = serialize_method
+
+ # The ignore attribute should be a string that references the
+ # attribute on a custom class object which holds strings and / or
+ # references of the attributes the class translator should ignore.
+ self.ignore_attribute = ignore_attribute
+
+ # The list of serialize handler functions for jsonclass dump.
+ # Used for handling additional types and overriding built-in types.
+ # Functions are expected to have the same parameters as jsonclass dump
+ # (possibility to call standard jsonclass dump function within).
+ self.serialize_handlers = serialize_handlers or {}
+
+ def copy(self):
+ """
+ Returns a shallow copy of this configuration bean
+
+ :return: A shallow copy of this configuration
+ """
+ new_config = Config(self.version, self.content_type, self.user_agent,
+ self.use_jsonclass, self.serialize_method,
+ self.ignore_attribute, None)
+ new_config.classes = self.classes.copy()
+ new_config.serialize_handlers = self.serialize_handlers.copy()
+ return new_config
+
+# Default configuration
+DEFAULT = Config()
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py
index 7062ab66..288d9539 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/history.py
@@ -1,95 +1,95 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-The history module.
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-
-class History(object):
- """
- This holds all the response and request objects for a
- session. A server using this should call "clear" after
- each request cycle in order to keep it from clogging
- memory.
- """
- def __init__(self):
- """
- Sets up members
- """
- self.requests = []
- self.responses = []
-
- def add_response(self, response_obj):
- """
- Adds a response to the history
-
- :param response_obj: Response content
- """
- self.responses.append(response_obj)
-
- def add_request(self, request_obj):
- """
- Adds a request to the history
-
- :param request_obj: A request object
- """
- self.requests.append(request_obj)
-
- @property
- def request(self):
- """
- Returns the latest stored request or None
- """
- try:
- return self.requests[-1]
-
- except IndexError:
- return None
-
- @property
- def response(self):
- """
- Returns the latest stored response or None
- """
- try:
- return self.responses[-1]
-
- except IndexError:
- return None
-
- def clear(self):
- """
- Clears the history lists
- """
- del self.requests[:]
- del self.responses[:]
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+The history module.
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+
+class History(object):
+ """
+ This holds all the response and request objects for a
+ session. A server using this should call "clear" after
+ each request cycle in order to keep it from clogging
+ memory.
+ """
+ def __init__(self):
+ """
+ Sets up members
+ """
+ self.requests = []
+ self.responses = []
+
+ def add_response(self, response_obj):
+ """
+ Adds a response to the history
+
+ :param response_obj: Response content
+ """
+ self.responses.append(response_obj)
+
+ def add_request(self, request_obj):
+ """
+ Adds a request to the history
+
+ :param request_obj: A request object
+ """
+ self.requests.append(request_obj)
+
+ @property
+ def request(self):
+ """
+ Returns the latest stored request or None
+ """
+ try:
+ return self.requests[-1]
+
+ except IndexError:
+ return None
+
+ @property
+ def response(self):
+ """
+ Returns the latest stored response or None
+ """
+ try:
+ return self.responses[-1]
+
+ except IndexError:
+ return None
+
+ def clear(self):
+ """
+ Clears the history lists
+ """
+ del self.requests[:]
+ del self.responses[:]
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py
index c7cc4c35..6bcbeab7 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonclass.py
@@ -1,295 +1,295 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-The serialization module
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-# Local package
-import jsonrpclib.config
-import jsonrpclib.utils as utils
-
-# Standard library
-import inspect
-import re
-
-# ------------------------------------------------------------------------------
-
-# Supported transmitted code
-SUPPORTED_TYPES = (utils.DictType,) + utils.iterable_types \
- + utils.primitive_types
-
-# Regex of invalid module characters
-INVALID_MODULE_CHARS = r'[^a-zA-Z0-9\_\.]'
-
-# ------------------------------------------------------------------------------
-
-
-class TranslationError(Exception):
- """
- Unmarshaling exception
- """
- pass
-
-
-def _slots_finder(clazz, fields_set):
- """
- Recursively visits the class hierarchy to find all slots
-
- :param clazz: Class to analyze
- :param fields_set: Set where to store __slots___ content
- """
- # ... class level
- try:
- fields_set.update(clazz.__slots__)
- except AttributeError:
- pass
-
- # ... parent classes level
- for base_class in clazz.__bases__:
- _slots_finder(base_class, fields_set)
-
-
-def _find_fields(obj):
- """
- Returns the names of the fields of the given object
-
- :param obj: An object to analyze
- :return: A set of field names
- """
- # Find fields...
- fields = set()
-
- # ... using __dict__
- try:
- fields.update(obj.__dict__)
- except AttributeError:
- pass
-
- # ... using __slots__
- _slots_finder(obj.__class__, fields)
- return fields
-
-
-def dump(obj, serialize_method=None, ignore_attribute=None, ignore=None,
- config=jsonrpclib.config.DEFAULT):
- """
- Transforms the given object into a JSON-RPC compliant form.
- Converts beans into dictionaries with a __jsonclass__ entry.
- Doesn't change primitive types.
-
- :param obj: An object to convert
- :param serialize_method: Custom serialization method
- :param ignore_attribute: Name of the object attribute containing the names
- of members to ignore
- :param ignore: A list of members to ignore
- :param config: A JSONRPClib Config instance
- :return: A JSON-RPC compliant object
- """
- # Normalize arguments
- serialize_method = serialize_method or config.serialize_method
- ignore_attribute = ignore_attribute or config.ignore_attribute
- ignore = ignore or []
-
- # Parse / return default "types"...
- # Apply additional types, override built-in types
- # (reminder: config.serialize_handlers is a dict)
- try:
- serializer = config.serialize_handlers[type(obj)]
- except KeyError:
- # Not a serializer
- pass
- else:
- if serializer is not None:
- return serializer(obj, serialize_method, ignore_attribute,
- ignore, config)
-
- # Primitive
- if isinstance(obj, utils.primitive_types):
- return obj
-
- # Iterative
- elif isinstance(obj, utils.iterable_types):
- # List, set or tuple
- return [dump(item, serialize_method, ignore_attribute, ignore, config)
- for item in obj]
-
- elif isinstance(obj, utils.DictType):
- # Dictionary
- return dict((key, dump(value, serialize_method,
- ignore_attribute, ignore, config))
- for key, value in obj.items())
-
- # It's not a standard type, so it needs __jsonclass__
- module_name = inspect.getmodule(type(obj)).__name__
- json_class = obj.__class__.__name__
-
- if module_name not in ('', '__main__'):
- json_class = '{0}.{1}'.format(module_name, json_class)
-
- # Keep the class name in the returned object
- return_obj = {"__jsonclass__": [json_class]}
-
- # If a serialization method is defined..
- if hasattr(obj, serialize_method):
- # Params can be a dict (keyword) or list (positional)
- # Attrs MUST be a dict.
- serialize = getattr(obj, serialize_method)
- params, attrs = serialize()
- return_obj['__jsonclass__'].append(params)
- return_obj.update(attrs)
- return return_obj
-
- else:
- # Otherwise, try to figure it out
- # Obviously, we can't assume to know anything about the
- # parameters passed to __init__
- return_obj['__jsonclass__'].append([])
-
- # Prepare filtering lists
- known_types = SUPPORTED_TYPES + tuple(config.serialize_handlers)
- ignore_list = getattr(obj, ignore_attribute, []) + ignore
-
- # Find fields and filter them by name
- fields = _find_fields(obj)
- fields.difference_update(ignore_list)
-
- # Dump field values
- attrs = {}
- for attr_name in fields:
- attr_value = getattr(obj, attr_name)
- if isinstance(attr_value, known_types) and \
- attr_value not in ignore_list:
- attrs[attr_name] = dump(attr_value, serialize_method,
- ignore_attribute, ignore, config)
- return_obj.update(attrs)
- return return_obj
-
-# ------------------------------------------------------------------------------
-
-
-def load(obj, classes=None):
- """
- If 'obj' is a dictionary containing a __jsonclass__ entry, converts the
- dictionary item into a bean of this class.
-
- :param obj: An object from a JSON-RPC dictionary
- :param classes: A custom {name: class} dictionary
- :return: The loaded object
- """
- # Primitive
- if isinstance(obj, utils.primitive_types):
- return obj
-
- # List, set or tuple
- elif isinstance(obj, utils.iterable_types):
- # This comes from a JSON parser, so it can only be a list...
- return [load(entry) for entry in obj]
-
- # Otherwise, it's a dict type
- elif '__jsonclass__' not in obj:
- return dict((key, load(value)) for key, value in obj.items())
-
- # It's a dictionary, and it has a __jsonclass__
- orig_module_name = obj['__jsonclass__'][0]
- params = obj['__jsonclass__'][1]
-
- # Validate the module name
- if not orig_module_name:
- raise TranslationError('Module name empty.')
-
- json_module_clean = re.sub(INVALID_MODULE_CHARS, '', orig_module_name)
- if json_module_clean != orig_module_name:
- raise TranslationError('Module name {0} has invalid characters.'
- .format(orig_module_name))
-
- # Load the class
- json_module_parts = json_module_clean.split('.')
- json_class = None
- if classes and len(json_module_parts) == 1:
- # Local class name -- probably means it won't work
- try:
- json_class = classes[json_module_parts[0]]
- except KeyError:
- raise TranslationError('Unknown class or module {0}.'
- .format(json_module_parts[0]))
-
- else:
- # Module + class
- json_class_name = json_module_parts.pop()
- json_module_tree = '.'.join(json_module_parts)
- try:
- # Use fromlist to load the module itself, not the package
- temp_module = __import__(json_module_tree,
- fromlist=[json_class_name])
- except ImportError:
- raise TranslationError('Could not import {0} from module {1}.'
- .format(json_class_name, json_module_tree))
-
- try:
- json_class = getattr(temp_module, json_class_name)
- except AttributeError:
- raise TranslationError("Unknown class {0}.{1}."
- .format(json_module_tree, json_class_name))
-
- # Create the object
- new_obj = None
- if isinstance(params, utils.ListType):
- try:
- new_obj = json_class(*params)
- except TypeError as ex:
- raise TranslationError("Error instantiating {0}: {1}"
- .format(json_class.__name__, ex))
-
- elif isinstance(params, utils.DictType):
- try:
- new_obj = json_class(**params)
- except TypeError as ex:
- raise TranslationError("Error instantiating {0}: {1}"
- .format(json_class.__name__, ex))
-
- else:
- raise TranslationError("Constructor args must be a dict or a list, "
- "not {0}".format(type(params).__name__))
-
- # Remove the class information, as it must be ignored during the
- # reconstruction of the object
- raw_jsonclass = obj.pop('__jsonclass__')
-
- for key, value in obj.items():
- # Recursive loading
- setattr(new_obj, key, load(value, classes))
-
- # Restore the class information for further usage
- obj['__jsonclass__'] = raw_jsonclass
-
- return new_obj
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+The serialization module
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+# Local package
+import jsonrpclib.config
+import jsonrpclib.utils as utils
+
+# Standard library
+import inspect
+import re
+
+# ------------------------------------------------------------------------------
+
+# Supported transmitted code
+SUPPORTED_TYPES = (utils.DictType,) + utils.iterable_types \
+ + utils.primitive_types
+
+# Regex of invalid module characters
+INVALID_MODULE_CHARS = r'[^a-zA-Z0-9\_\.]'
+
+# ------------------------------------------------------------------------------
+
+
+class TranslationError(Exception):
+ """
+ Unmarshaling exception
+ """
+ pass
+
+
+def _slots_finder(clazz, fields_set):
+ """
+ Recursively visits the class hierarchy to find all slots
+
+ :param clazz: Class to analyze
+ :param fields_set: Set where to store __slots___ content
+ """
+ # ... class level
+ try:
+ fields_set.update(clazz.__slots__)
+ except AttributeError:
+ pass
+
+ # ... parent classes level
+ for base_class in clazz.__bases__:
+ _slots_finder(base_class, fields_set)
+
+
+def _find_fields(obj):
+ """
+ Returns the names of the fields of the given object
+
+ :param obj: An object to analyze
+ :return: A set of field names
+ """
+ # Find fields...
+ fields = set()
+
+ # ... using __dict__
+ try:
+ fields.update(obj.__dict__)
+ except AttributeError:
+ pass
+
+ # ... using __slots__
+ _slots_finder(obj.__class__, fields)
+ return fields
+
+
+def dump(obj, serialize_method=None, ignore_attribute=None, ignore=None,
+ config=jsonrpclib.config.DEFAULT):
+ """
+ Transforms the given object into a JSON-RPC compliant form.
+ Converts beans into dictionaries with a __jsonclass__ entry.
+ Doesn't change primitive types.
+
+ :param obj: An object to convert
+ :param serialize_method: Custom serialization method
+ :param ignore_attribute: Name of the object attribute containing the names
+ of members to ignore
+ :param ignore: A list of members to ignore
+ :param config: A JSONRPClib Config instance
+ :return: A JSON-RPC compliant object
+ """
+ # Normalize arguments
+ serialize_method = serialize_method or config.serialize_method
+ ignore_attribute = ignore_attribute or config.ignore_attribute
+ ignore = ignore or []
+
+ # Parse / return default "types"...
+ # Apply additional types, override built-in types
+ # (reminder: config.serialize_handlers is a dict)
+ try:
+ serializer = config.serialize_handlers[type(obj)]
+ except KeyError:
+ # Not a serializer
+ pass
+ else:
+ if serializer is not None:
+ return serializer(obj, serialize_method, ignore_attribute,
+ ignore, config)
+
+ # Primitive
+ if isinstance(obj, utils.primitive_types):
+ return obj
+
+ # Iterative
+ elif isinstance(obj, utils.iterable_types):
+ # List, set or tuple
+ return [dump(item, serialize_method, ignore_attribute, ignore, config)
+ for item in obj]
+
+ elif isinstance(obj, utils.DictType):
+ # Dictionary
+ return dict((key, dump(value, serialize_method,
+ ignore_attribute, ignore, config))
+ for key, value in obj.items())
+
+ # It's not a standard type, so it needs __jsonclass__
+ module_name = inspect.getmodule(type(obj)).__name__
+ json_class = obj.__class__.__name__
+
+ if module_name not in ('', '__main__'):
+ json_class = '{0}.{1}'.format(module_name, json_class)
+
+ # Keep the class name in the returned object
+ return_obj = {"__jsonclass__": [json_class]}
+
+ # If a serialization method is defined..
+ if hasattr(obj, serialize_method):
+ # Params can be a dict (keyword) or list (positional)
+ # Attrs MUST be a dict.
+ serialize = getattr(obj, serialize_method)
+ params, attrs = serialize()
+ return_obj['__jsonclass__'].append(params)
+ return_obj.update(attrs)
+ return return_obj
+
+ else:
+ # Otherwise, try to figure it out
+ # Obviously, we can't assume to know anything about the
+ # parameters passed to __init__
+ return_obj['__jsonclass__'].append([])
+
+ # Prepare filtering lists
+ known_types = SUPPORTED_TYPES + tuple(config.serialize_handlers)
+ ignore_list = getattr(obj, ignore_attribute, []) + ignore
+
+ # Find fields and filter them by name
+ fields = _find_fields(obj)
+ fields.difference_update(ignore_list)
+
+ # Dump field values
+ attrs = {}
+ for attr_name in fields:
+ attr_value = getattr(obj, attr_name)
+ if isinstance(attr_value, known_types) and \
+ attr_value not in ignore_list:
+ attrs[attr_name] = dump(attr_value, serialize_method,
+ ignore_attribute, ignore, config)
+ return_obj.update(attrs)
+ return return_obj
+
+# ------------------------------------------------------------------------------
+
+
+def load(obj, classes=None):
+ """
+ If 'obj' is a dictionary containing a __jsonclass__ entry, converts the
+ dictionary item into a bean of this class.
+
+ :param obj: An object from a JSON-RPC dictionary
+ :param classes: A custom {name: class} dictionary
+ :return: The loaded object
+ """
+ # Primitive
+ if isinstance(obj, utils.primitive_types):
+ return obj
+
+ # List, set or tuple
+ elif isinstance(obj, utils.iterable_types):
+ # This comes from a JSON parser, so it can only be a list...
+ return [load(entry) for entry in obj]
+
+ # Otherwise, it's a dict type
+ elif '__jsonclass__' not in obj:
+ return dict((key, load(value)) for key, value in obj.items())
+
+ # It's a dictionary, and it has a __jsonclass__
+ orig_module_name = obj['__jsonclass__'][0]
+ params = obj['__jsonclass__'][1]
+
+ # Validate the module name
+ if not orig_module_name:
+ raise TranslationError('Module name empty.')
+
+ json_module_clean = re.sub(INVALID_MODULE_CHARS, '', orig_module_name)
+ if json_module_clean != orig_module_name:
+ raise TranslationError('Module name {0} has invalid characters.'
+ .format(orig_module_name))
+
+ # Load the class
+ json_module_parts = json_module_clean.split('.')
+ json_class = None
+ if classes and len(json_module_parts) == 1:
+ # Local class name -- probably means it won't work
+ try:
+ json_class = classes[json_module_parts[0]]
+ except KeyError:
+ raise TranslationError('Unknown class or module {0}.'
+ .format(json_module_parts[0]))
+
+ else:
+ # Module + class
+ json_class_name = json_module_parts.pop()
+ json_module_tree = '.'.join(json_module_parts)
+ try:
+ # Use fromlist to load the module itself, not the package
+ temp_module = __import__(json_module_tree,
+ fromlist=[json_class_name])
+ except ImportError:
+ raise TranslationError('Could not import {0} from module {1}.'
+ .format(json_class_name, json_module_tree))
+
+ try:
+ json_class = getattr(temp_module, json_class_name)
+ except AttributeError:
+ raise TranslationError("Unknown class {0}.{1}."
+ .format(json_module_tree, json_class_name))
+
+ # Create the object
+ new_obj = None
+ if isinstance(params, utils.ListType):
+ try:
+ new_obj = json_class(*params)
+ except TypeError as ex:
+ raise TranslationError("Error instantiating {0}: {1}"
+ .format(json_class.__name__, ex))
+
+ elif isinstance(params, utils.DictType):
+ try:
+ new_obj = json_class(**params)
+ except TypeError as ex:
+ raise TranslationError("Error instantiating {0}: {1}"
+ .format(json_class.__name__, ex))
+
+ else:
+ raise TranslationError("Constructor args must be a dict or a list, "
+ "not {0}".format(type(params).__name__))
+
+ # Remove the class information, as it must be ignored during the
+ # reconstruction of the object
+ raw_jsonclass = obj.pop('__jsonclass__')
+
+ for key, value in obj.items():
+ # Recursive loading
+ setattr(new_obj, key, load(value, classes))
+
+ # Restore the class information for further usage
+ obj['__jsonclass__'] = raw_jsonclass
+
+ return new_obj
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py
index 8ee902b0..8ea3a9c8 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/jsonrpc.py
@@ -1,1192 +1,1192 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-============================
-JSONRPC Library (jsonrpclib)
-============================
-
-This library is a JSON-RPC v.2 (proposed) implementation which
-follows the xmlrpclib API for portability between clients. It
-uses the same Server / ServerProxy, loads, dumps, etc. syntax,
-while providing features not present in XML-RPC like:
-
-* Keyword arguments
-* Notifications
-* Versioning
-* Batches and batch notifications
-
-Eventually, I'll add a SimpleXMLRPCServer compatible library,
-and other things to tie the thing off nicely. :)
-
-For a quick-start, just open a console and type the following,
-replacing the server address, method, and parameters
-appropriately.
->>> import jsonrpclib
->>> server = jsonrpclib.Server('http://localhost:8181')
->>> server.add(5, 6)
-11
->>> server._notify.add(5, 6)
->>> batch = jsonrpclib.MultiCall(server)
->>> batch.add(3, 50)
->>> batch.add(2, 3)
->>> batch._notify.add(3, 5)
->>> batch()
-[53, 5]
-
-See https://github.com/tcalmant/jsonrpclib for more info.
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-# Library includes
-import jsonrpclib.config
-import jsonrpclib.utils as utils
-
-# Standard library
-import contextlib
-import logging
-import sys
-import uuid
-
-# Create the logger
-_logger = logging.getLogger(__name__)
-
-try:
- # Python 3
- # pylint: disable=F0401,E0611
- from urllib.parse import splittype
- from urllib.parse import splithost
- from xmlrpc.client import Transport as XMLTransport
- from xmlrpc.client import SafeTransport as XMLSafeTransport
- from xmlrpc.client import ServerProxy as XMLServerProxy
- from xmlrpc.client import _Method as XML_Method
-
-except ImportError:
- # Python 2
- # pylint: disable=F0401,E0611
- from urllib import splittype
- from urllib import splithost
- from xmlrpclib import Transport as XMLTransport
- from xmlrpclib import SafeTransport as XMLSafeTransport
- from xmlrpclib import ServerProxy as XMLServerProxy
- from xmlrpclib import _Method as XML_Method
-
-# ------------------------------------------------------------------------------
-# JSON library import
-
-# JSON class serialization
-from jsonrpclib import jsonclass
-
-try:
- # pylint: disable=F0401,E0611
- # Using cjson
- import cjson
- _logger.debug("Using cjson as JSON library")
-
- # Declare cjson methods
- def jdumps(obj, encoding='utf-8'):
- """
- Serializes ``obj`` to a JSON formatted string, using cjson.
- """
- return cjson.encode(obj)
-
- def jloads(json_string):
- """
- Deserializes ``json_string`` (a string containing a JSON document)
- to a Python object, using cjson.
- """
- return cjson.decode(json_string)
-
-except ImportError:
- # pylint: disable=F0401,E0611
- # Use json or simplejson
- try:
- import json
- _logger.debug("Using json as JSON library")
-
- except ImportError:
- try:
- import simplejson as json
- _logger.debug("Using simplejson as JSON library")
- except ImportError:
- _logger.error("No supported JSON library found")
- raise ImportError('You must have the cjson, json, or simplejson '
- 'module(s) available.')
-
- # Declare json methods
- if sys.version_info[0] < 3:
- def jdumps(obj, encoding='utf-8'):
- """
- Serializes ``obj`` to a JSON formatted string.
- """
- # Python 2 (explicit encoding)
- return json.dumps(obj, encoding=encoding)
-
- else:
- # Python 3
- def jdumps(obj, encoding='utf-8'):
- """
- Serializes ``obj`` to a JSON formatted string.
- """
- # Python 3 (the encoding parameter has been removed)
- return json.dumps(obj)
-
- def jloads(json_string):
- """
- Deserializes ``json_string`` (a string containing a JSON document)
- to a Python object.
- """
- return json.loads(json_string)
-
-# ------------------------------------------------------------------------------
-# XMLRPClib re-implementations
-
-
-class ProtocolError(Exception):
- """
- JSON-RPC error
-
- ProtocolError.args[0] can be:
- * an error message (string)
- * a (code, message) tuple
- """
- pass
-
-
-class AppError(ProtocolError):
- """
- Application error: the error code is not in the pre-defined ones
-
- AppError.args[0][0]: Error code
- AppError.args[0][1]: Error message or trace
- AppError.args[0][2]: Associated data
- """
- def data(self):
- """
- Retrieves the value found in the 'data' entry of the error, or None
-
- :return: The data associated to the error, or None
- """
- return self.args[0][2]
-
-
-class JSONParser(object):
- """
- Default JSON parser
- """
- def __init__(self, target):
- """
- Associates the target loader to the parser
-
- :param target: a JSONTarget instance
- """
- self.target = target
-
- def feed(self, data):
- """
- Feeds the associated target with the given data
- """
- self.target.feed(data)
-
- def close(self):
- """
- Does nothing
- """
- pass
-
-
-class JSONTarget(object):
- """
- Unmarshalls stream data to a string
- """
- def __init__(self):
- """
- Sets up the unmarshaller
- """
- self.data = []
-
- def feed(self, data):
- """
- Stores the given raw data into a buffer
- """
- # Store raw data as it might not contain whole wide-character
- self.data.append(data)
-
- def close(self):
- """
- Unmarshalls the buffered data
- """
- if not self.data:
- return ''
- else:
- # Use type to have a valid join (str vs. bytes)
- data = type(self.data[0])().join(self.data)
- try:
- # Convert the whole final string
- data = utils.from_bytes(data)
- except:
- # Try a pass-through
- pass
-
- return data
-
-
-class TransportMixIn(object):
- """ Just extends the XMLRPC transport where necessary. """
- # for Python 2.7 support
- _connection = None
-
- # List of non-overridable headers
- # Use the configuration to change the content-type
- readonly_headers = ('content-length', 'content-type')
-
- def __init__(self, config=jsonrpclib.config.DEFAULT, context=None):
- """
- Sets up the transport
-
- :param config: A JSONRPClib Config instance
- """
- # Store the configuration
- self._config = config
-
- # Store the SSL context
- self.context = context
-
- # Set up the user agent
- self.user_agent = config.user_agent
-
- # Additional headers: list of dictionaries
- self.additional_headers = []
-
- def push_headers(self, headers):
- """
- Adds a dictionary of headers to the additional headers list
-
- :param headers: A dictionary
- """
- self.additional_headers.append(headers)
-
- def pop_headers(self, headers):
- """
- Removes the given dictionary from the additional headers list.
- Also validates that given headers are on top of the stack
-
- :param headers: Headers to remove
- :raise AssertionError: The given dictionary is not on the latest stored
- in the additional headers list
- """
- assert self.additional_headers[-1] == headers
- self.additional_headers.pop()
-
- def emit_additional_headers(self, connection):
- """
- Puts headers as is in the request, filtered read only headers
-
- :param connection: The request connection
- """
- additional_headers = {}
-
- # Prepare the merged dictionary
- for headers in self.additional_headers:
- additional_headers.update(headers)
-
- # Remove forbidden keys
- for forbidden in self.readonly_headers:
- additional_headers.pop(forbidden, None)
-
- # Reversed order: in the case of multiple headers value definition,
- # the latest pushed has priority
- for key, value in additional_headers.items():
- key = str(key)
- if key.lower() not in self.readonly_headers:
- # Only accept replaceable headers
- connection.putheader(str(key), str(value))
-
- def send_content(self, connection, request_body):
- """
- Completes the request headers and sends the request body of a JSON-RPC
- request over a HTTPConnection
-
- :param connection: An HTTPConnection object
- :param request_body: JSON-RPC request body
- """
- # Convert the body first
- request_body = utils.to_bytes(request_body)
-
- # "static" headers
- connection.putheader("Content-Type", self._config.content_type)
- connection.putheader("Content-Length", str(len(request_body)))
-
- # Emit additional headers here in order not to override content-length
- self.emit_additional_headers(connection)
-
- connection.endheaders()
- if request_body:
- connection.send(request_body)
-
- def getparser(self):
- """
- Create an instance of the parser, and attach it to an unmarshalling
- object. Return both objects.
-
- :return: The parser and unmarshaller instances
- """
- target = JSONTarget()
- return JSONParser(target), target
-
-
-class Transport(TransportMixIn, XMLTransport):
- """
- Mixed-in HTTP transport
- """
- pass
-
-
-class SafeTransport(TransportMixIn, XMLSafeTransport):
- """
- Mixed-in HTTPS transport
- """
- pass
-
-# ------------------------------------------------------------------------------
-
-
-class ServerProxy(XMLServerProxy):
- """
- Unfortunately, much more of this class has to be copied since
- so much of it does the serialization.
- """
- def __init__(self, uri, transport=None, encoding=None,
- verbose=0, version=None, headers=None, history=None,
- config=jsonrpclib.config.DEFAULT, context=None):
- """
- Sets up the server proxy
-
- :param uri: Request URI
- :param transport: Custom transport handler
- :param encoding: Specified encoding
- :param verbose: Log verbosity level
- :param version: JSON-RPC specification version
- :param headers: Custom additional headers for each request
- :param history: History object (for tests)
- :param config: A JSONRPClib Config instance
- :param context: The optional SSLContext to use
- """
- # Store the configuration
- self._config = config
- self.__version = version or config.version
-
- schema, uri = splittype(uri)
- if schema not in ('http', 'https'):
- _logger.error("jsonrpclib only support http(s) URIs, not %s",
- schema)
- raise IOError('Unsupported JSON-RPC protocol.')
-
- self.__host, self.__handler = splithost(uri)
- if not self.__handler:
- # Not sure if this is in the JSON spec?
- self.__handler = '/'
-
- if transport is None:
- if schema == 'https':
- transport = SafeTransport(config=config, context=context)
- else:
- transport = Transport(config=config)
- self.__transport = transport
-
- self.__encoding = encoding
- self.__verbose = verbose
- self.__history = history
-
- # Global custom headers are injected into Transport
- self.__transport.push_headers(headers or {})
-
- def _request(self, methodname, params, rpcid=None):
- """
- Calls a method on the remote server
-
- :param methodname: Name of the method to call
- :param params: Method parameters
- :param rpcid: ID of the remote call
- :return: The parsed result of the call
- """
- request = dumps(params, methodname, encoding=self.__encoding,
- rpcid=rpcid, version=self.__version,
- config=self._config)
- response = self._run_request(request)
- check_for_errors(response)
- return response['result']
-
- def _request_notify(self, methodname, params, rpcid=None):
- """
- Calls a method as a notification
-
- :param methodname: Name of the method to call
- :param params: Method parameters
- :param rpcid: ID of the remote call
- """
- request = dumps(params, methodname, encoding=self.__encoding,
- rpcid=rpcid, version=self.__version, notify=True,
- config=self._config)
- response = self._run_request(request, notify=True)
- check_for_errors(response)
-
- def _run_request(self, request, notify=False):
- """
- Sends the given request to the remote server
-
- :param request: The request to send
- :param notify: Notification request flag (unused)
- :return: The response as a parsed JSON object
- """
- if self.__history is not None:
- self.__history.add_request(request)
-
- response = self.__transport.request(
- self.__host,
- self.__handler,
- request,
- verbose=self.__verbose
- )
-
- # Here, the XMLRPC library translates a single list
- # response to the single value -- should we do the
- # same, and require a tuple / list to be passed to
- # the response object, or expect the Server to be
- # outputting the response appropriately?
-
- if self.__history is not None:
- self.__history.add_response(response)
-
- if not response:
- return None
- else:
- return_obj = loads(response, self._config)
- return return_obj
-
- def __getattr__(self, name):
- """
- Returns a callable object to call the remote service
- """
- # Same as original, just with new _Method reference
- return _Method(self._request, name)
-
- def __close(self):
- """
- Closes the transport layer
- """
- try:
- self.__transport.close()
- except AttributeError:
- # Not available in Python 2.6
- pass
-
- def __call__(self, attr):
- """
- A workaround to get special attributes on the ServerProxy
- without interfering with the magic __getattr__
-
- (code from xmlrpclib in Python 2.7)
- """
- if attr == "close":
- return self.__close
-
- elif attr == "transport":
- return self.__transport
-
- raise AttributeError("Attribute {0} not found".format(attr))
-
- @property
- def _notify(self):
- """
- Like __getattr__, but sending a notification request instead of a call
- """
- return _Notify(self._request_notify)
-
- @contextlib.contextmanager
- def _additional_headers(self, headers):
- """
- Allows to specify additional headers, to be added inside the with
- block.
- Example of usage:
-
- >>> with client._additional_headers({'X-Test' : 'Test'}) as new_client:
- ... new_client.method()
- ...
- >>> # Here old headers are restored
- """
- self.__transport.push_headers(headers)
- yield self
- self.__transport.pop_headers(headers)
-
-# ------------------------------------------------------------------------------
-
-
-class _Method(XML_Method):
- """
- Some magic to bind an JSON-RPC method to an RPC server.
- """
- def __call__(self, *args, **kwargs):
- """
- Sends an RPC request and returns the unmarshalled result
- """
- if args and kwargs:
- raise ProtocolError("Cannot use both positional and keyword "
- "arguments (according to JSON-RPC spec.)")
- if args:
- return self.__send(self.__name, args)
- else:
- return self.__send(self.__name, kwargs)
-
- def __getattr__(self, name):
- """
- Returns a Method object for nested calls
- """
- if name == "__name__":
- return self.__name
- return _Method(self.__send, "{0}.{1}".format(self.__name, name))
-
-
-class _Notify(object):
- """
- Same as _Method, but to send notifications
- """
- def __init__(self, request):
- """
- Sets the method to call to send a request to the server
- """
- self._request = request
-
- def __getattr__(self, name):
- """
- Returns a Method object, to be called as a notification
- """
- return _Method(self._request, name)
-
-# ------------------------------------------------------------------------------
-# Batch implementation
-
-
-class MultiCallMethod(object):
- """
- Stores calls made to a MultiCall object for batch execution
- """
- def __init__(self, method, notify=False, config=jsonrpclib.config.DEFAULT):
- """
- Sets up the store
-
- :param method: Name of the method to call
- :param notify: Notification flag
- :param config: Request configuration
- """
- self.method = method
- self.params = []
- self.notify = notify
- self._config = config
-
- def __call__(self, *args, **kwargs):
- """
- Normalizes call parameters
- """
- if kwargs and args:
- raise ProtocolError('JSON-RPC does not support both ' +
- 'positional and keyword arguments.')
- if kwargs:
- self.params = kwargs
- else:
- self.params = args
-
- def request(self, encoding=None, rpcid=None):
- """
- Returns the request object as JSON-formatted string
- """
- return dumps(self.params, self.method, version=2.0,
- encoding=encoding, rpcid=rpcid, notify=self.notify,
- config=self._config)
-
- def __repr__(self):
- """
- String representation
- """
- return str(self.request())
-
- def __getattr__(self, method):
- """
- Updates the object for a nested call
- """
- self.method = "{0}.{1}".format(self.method, method)
- return self
-
-
-class MultiCallNotify(object):
- """
- Same as MultiCallMethod but for notifications
- """
- def __init__(self, multicall, config=jsonrpclib.config.DEFAULT):
- """
- Sets ip the store
-
- :param multicall: The parent MultiCall instance
- :param config: Request configuration
- """
- self.multicall = multicall
- self._config = config
-
- def __getattr__(self, name):
- """
- Returns the MultiCallMethod to use as a notification
- """
- new_job = MultiCallMethod(name, notify=True, config=self._config)
- self.multicall._job_list.append(new_job)
- return new_job
-
-
-class MultiCallIterator(object):
- """
- Iterates over the results of a MultiCall.
- Exceptions are raised in response to JSON-RPC faults
- """
- def __init__(self, results):
- """
- Sets up the results store
- """
- self.results = results
-
- def __get_result(self, item):
- """
- Checks for error and returns the "real" result stored in a MultiCall
- result.
- """
- check_for_errors(item)
- return item['result']
-
- def __iter__(self):
- """
- Iterates over all results
- """
- for item in self.results:
- yield self.__get_result(item)
- raise StopIteration
-
- def __getitem__(self, i):
- """
- Returns the i-th object of the results
- """
- return self.__get_result(self.results[i])
-
- def __len__(self):
- """
- Returns the number of results stored
- """
- return len(self.results)
-
-
-class MultiCall(object):
- """
- server -> a object used to boxcar method calls, where server should be a
- ServerProxy object.
-
- Methods can be added to the MultiCall using normal
- method call syntax e.g.:
-
- multicall = MultiCall(server_proxy)
- multicall.add(2,3)
- multicall.get_address("Guido")
-
- To execute the multicall, call the MultiCall object e.g.:
-
- add_result, address = multicall()
- """
- def __init__(self, server, config=jsonrpclib.config.DEFAULT):
- """
- Sets up the multicall
-
- :param server: A ServerProxy object
- :param config: Request configuration
- """
- self._server = server
- self._job_list = []
- self._config = config
-
- def _request(self):
- """
- Sends the request to the server and returns the responses
-
- :return: A MultiCallIterator object
- """
- if len(self._job_list) < 1:
- # Should we alert? This /is/ pretty obvious.
- return
- request_body = "[ {0} ]".format(
- ','.join(job.request() for job in self._job_list))
- responses = self._server._run_request(request_body)
- del self._job_list[:]
- if not responses:
- responses = []
- return MultiCallIterator(responses)
-
- @property
- def _notify(self):
- """
- Prepares a notification call
- """
- return MultiCallNotify(self, self._config)
-
- def __getattr__(self, name):
- """
- Registers a method call
- """
- new_job = MultiCallMethod(name, config=self._config)
- self._job_list.append(new_job)
- return new_job
-
- __call__ = _request
-
-# These lines conform to xmlrpclib's "compatibility" line.
-# Not really sure if we should include these, but oh well.
-Server = ServerProxy
-
-# ------------------------------------------------------------------------------
-
-
-class Fault(object):
- """
- JSON-RPC error class
- """
- def __init__(self, code=-32000, message='Server error', rpcid=None,
- config=jsonrpclib.config.DEFAULT, data=None):
- """
- Sets up the error description
-
- :param code: Fault code
- :param message: Associated message
- :param rpcid: Request ID
- :param config: A JSONRPClib Config instance
- :param data: Extra information added to an error description
- """
- self.faultCode = code
- self.faultString = message
- self.rpcid = rpcid
- self.config = config
- self.data = data
-
- def error(self):
- """
- Returns the error as a dictionary
-
- :returns: A {'code', 'message'} dictionary
- """
- return {'code': self.faultCode, 'message': self.faultString,
- 'data': self.data}
-
- def response(self, rpcid=None, version=None):
- """
- Returns the error as a JSON-RPC response string
-
- :param rpcid: Forced request ID
- :param version: JSON-RPC version
- :return: A JSON-RPC response string
- """
- if not version:
- version = self.config.version
-
- if rpcid:
- self.rpcid = rpcid
-
- return dumps(self, methodresponse=True, rpcid=self.rpcid,
- version=version, config=self.config)
-
- def dump(self, rpcid=None, version=None):
- """
- Returns the error as a JSON-RPC response dictionary
-
- :param rpcid: Forced request ID
- :param version: JSON-RPC version
- :return: A JSON-RPC response dictionary
- """
- if not version:
- version = self.config.version
-
- if rpcid:
- self.rpcid = rpcid
-
- return dump(self, is_response=True, rpcid=self.rpcid,
- version=version, config=self.config)
-
- def __repr__(self):
- """
- String representation
- """
- return '<Fault {0}: {1}>'.format(self.faultCode, self.faultString)
-
-
-class Payload(object):
- """
- JSON-RPC content handler
- """
- def __init__(self, rpcid=None, version=None,
- config=jsonrpclib.config.DEFAULT):
- """
- Sets up the JSON-RPC handler
-
- :param rpcid: Request ID
- :param version: JSON-RPC version
- :param config: A JSONRPClib Config instance
- """
- if not version:
- version = config.version
-
- self.id = rpcid
- self.version = float(version)
-
- def request(self, method, params=None):
- """
- Prepares a method call request
-
- :param method: Method name
- :param params: Method parameters
- :return: A JSON-RPC request dictionary
- """
- if not isinstance(method, utils.string_types):
- raise ValueError('Method name must be a string.')
-
- if not self.id:
- # Generate a request ID
- self.id = str(uuid.uuid4())
-
- request = {'id': self.id, 'method': method}
- if params or self.version < 1.1:
- request['params'] = params or []
-
- if self.version >= 2:
- request['jsonrpc'] = str(self.version)
-
- return request
-
- def notify(self, method, params=None):
- """
- Prepares a notification request
-
- :param method: Notification name
- :param params: Notification parameters
- :return: A JSON-RPC notification dictionary
- """
- # Prepare the request dictionary
- request = self.request(method, params)
-
- # Remove the request ID, as it's a notification
- if self.version >= 2:
- del request['id']
- else:
- request['id'] = None
-
- return request
-
- def response(self, result=None):
- """
- Prepares a response dictionary
-
- :param result: The result of method call
- :return: A JSON-RPC response dictionary
- """
- response = {'result': result, 'id': self.id}
-
- if self.version >= 2:
- response['jsonrpc'] = str(self.version)
- else:
- response['error'] = None
-
- return response
-
- def error(self, code=-32000, message='Server error.', data=None):
- """
- Prepares an error dictionary
-
- :param code: Error code
- :param message: Error message
- :return: A JSON-RPC error dictionary
- """
- error = self.response()
- if self.version >= 2:
- del error['result']
- else:
- error['result'] = None
- error['error'] = {'code': code, 'message': message}
- if data is not None:
- error['error']['data'] = data
- return error
-
-# ------------------------------------------------------------------------------
-
-
-def dump(params=None, methodname=None, rpcid=None, version=None,
- is_response=None, is_notify=None, config=jsonrpclib.config.DEFAULT):
- """
- Prepares a JSON-RPC dictionary (request, notification, response or error)
-
- :param params: Method parameters (if a method name is given) or a Fault
- :param methodname: Method name
- :param rpcid: Request ID
- :param version: JSON-RPC version
- :param is_response: If True, this is a response dictionary
- :param is_notify: If True, this is a notification request
- :param config: A JSONRPClib Config instance
- :return: A JSON-RPC dictionary
- """
- # Default version
- if not version:
- version = config.version
-
- if not is_response and params is None:
- params = []
-
- # Validate method name and parameters
- valid_params = [utils.TupleType, utils.ListType, utils.DictType, Fault]
- if is_response:
- valid_params.append(type(None))
-
- if isinstance(methodname, utils.string_types) and \
- not isinstance(params, tuple(valid_params)):
- """
- If a method, and params are not in a listish or a Fault,
- error out.
- """
- raise TypeError("Params must be a dict, list, tuple "
- "or Fault instance.")
-
- # Prepares the JSON-RPC content
- payload = Payload(rpcid=rpcid, version=version)
-
- if isinstance(params, Fault):
- # Prepare an error dictionary
- # pylint: disable=E1103
- return payload.error(params.faultCode, params.faultString, params.data)
-
- if not isinstance(methodname, utils.string_types) and not is_response:
- # Neither a request nor a response
- raise ValueError('Method name must be a string, or is_response '
- 'must be set to True.')
-
- if config.use_jsonclass:
- # Use jsonclass to convert the parameters
- params = jsonclass.dump(params, config=config)
-
- if is_response:
- # Prepare a response dictionary
- if rpcid is None:
- # A response must have a request ID
- raise ValueError('A method response must have an rpcid.')
- return payload.response(params)
-
- if is_notify:
- # Prepare a notification dictionary
- return payload.notify(methodname, params)
- else:
- # Prepare a method call dictionary
- return payload.request(methodname, params)
-
-
-def dumps(params=None, methodname=None, methodresponse=None,
- encoding=None, rpcid=None, version=None, notify=None,
- config=jsonrpclib.config.DEFAULT):
- """
- Prepares a JSON-RPC request/response string
-
- :param params: Method parameters (if a method name is given) or a Fault
- :param methodname: Method name
- :param methodresponse: If True, this is a response dictionary
- :param encoding: Result string encoding
- :param rpcid: Request ID
- :param version: JSON-RPC version
- :param notify: If True, this is a notification request
- :param config: A JSONRPClib Config instance
- :return: A JSON-RPC dictionary
- """
- # Prepare the dictionary
- request = dump(params, methodname, rpcid, version, methodresponse, notify,
- config)
-
- # Returns it as a JSON string
- return jdumps(request, encoding=encoding or "UTF-8")
-
-
-def load(data, config=jsonrpclib.config.DEFAULT):
- """
- Loads a JSON-RPC request/response dictionary. Calls jsonclass to load beans
-
- :param data: A JSON-RPC dictionary
- :param config: A JSONRPClib Config instance (or None for default values)
- :return: A parsed dictionary or None
- """
- if data is None:
- # Notification
- return None
-
- # if the above raises an error, the implementing server code
- # should return something like the following:
- # { 'jsonrpc':'2.0', 'error': fault.error(), id: None }
- if config.use_jsonclass:
- # Convert beans
- data = jsonclass.load(data, config.classes)
-
- return data
-
-
-def loads(data, config=jsonrpclib.config.DEFAULT):
- """
- Loads a JSON-RPC request/response string. Calls jsonclass to load beans
-
- :param data: A JSON-RPC string
- :param config: A JSONRPClib Config instance (or None for default values)
- :return: A parsed dictionary or None
- """
- if data == '':
- # Notification
- return None
-
- # Parse the JSON dictionary
- result = jloads(data)
-
- # Load the beans
- return load(result, config)
-
-# ------------------------------------------------------------------------------
-
-
-def check_for_errors(result):
- """
- Checks if a result dictionary signals an error
-
- :param result: A result dictionary
- :raise TypeError: Invalid parameter
- :raise NotImplementedError: Unknown JSON-RPC version
- :raise ValueError: Invalid dictionary content
- :raise ProtocolError: An error occurred on the server side
- :return: The result parameter
- """
- if not result:
- # Notification
- return result
-
- if not isinstance(result, utils.DictType):
- # Invalid argument
- raise TypeError('Response is not a dict.')
-
- if 'jsonrpc' in result and float(result['jsonrpc']) > 2.0:
- # Unknown JSON-RPC version
- raise NotImplementedError('JSON-RPC version not yet supported.')
-
- if 'result' not in result and 'error' not in result:
- # Invalid dictionary content
- raise ValueError('Response does not have a result or error key.')
-
- if 'error' in result and result['error']:
- # Server-side error
- if 'code' in result['error']:
- # Code + Message
- code = result['error']['code']
- try:
- # Get the message (jsonrpclib)
- message = result['error']['message']
- except KeyError:
- # Get the trace (jabsorb)
- message = result['error'].get('trace', '<no error message>')
-
- if -32700 <= code <= -32000:
- # Pre-defined errors
- # See http://www.jsonrpc.org/specification#error_object
- raise ProtocolError((code, message))
- else:
- # Application error
- data = result['error'].get('data', None)
- raise AppError((code, message, data))
-
- elif isinstance(result['error'], dict) and len(result['error']) == 1:
- # Error with a single entry ('reason', ...): use its content
- error_key = result['error'].keys()[0]
- raise ProtocolError(result['error'][error_key])
-
- else:
- # Use the raw error content
- raise ProtocolError(result['error'])
-
- return result
-
-
-def isbatch(request):
- """
- Tests if the given request is a batch call, i.e. a list of multiple calls
- :param request: a JSON-RPC request object
- :return: True if the request is a batch call
- """
- if not isinstance(request, (utils.ListType, utils.TupleType)):
- # Not a list: not a batch call
- return False
- elif len(request) < 1:
- # Only one request: not a batch call
- return False
- elif not isinstance(request[0], utils.DictType):
- # One of the requests is not a dictionary, i.e. a JSON Object
- # therefore it is not a valid JSON-RPC request
- return False
- elif 'jsonrpc' not in request[0].keys():
- # No "jsonrpc" version in the JSON object: not a request
- return False
-
- try:
- version = float(request[0]['jsonrpc'])
- except ValueError:
- # Bad version of JSON-RPC
- raise ProtocolError('"jsonrpc" key must be a float(able) value.')
-
- if version < 2:
- # Batch call were not supported before JSON-RPC 2.0
- return False
-
- return True
-
-
-def isnotification(request):
- """
- Tests if the given request is a notification
-
- :param request: A request dictionary
- :return: True if the request is a notification
- """
- if 'id' not in request:
- # 2.0 notification
- return True
-
- if request['id'] is None:
- # 1.0 notification
- return True
-
- return False
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+============================
+JSONRPC Library (jsonrpclib)
+============================
+
+This library is a JSON-RPC v.2 (proposed) implementation which
+follows the xmlrpclib API for portability between clients. It
+uses the same Server / ServerProxy, loads, dumps, etc. syntax,
+while providing features not present in XML-RPC like:
+
+* Keyword arguments
+* Notifications
+* Versioning
+* Batches and batch notifications
+
+Eventually, I'll add a SimpleXMLRPCServer compatible library,
+and other things to tie the thing off nicely. :)
+
+For a quick-start, just open a console and type the following,
+replacing the server address, method, and parameters
+appropriately.
+>>> import jsonrpclib
+>>> server = jsonrpclib.Server('http://localhost:8181')
+>>> server.add(5, 6)
+11
+>>> server._notify.add(5, 6)
+>>> batch = jsonrpclib.MultiCall(server)
+>>> batch.add(3, 50)
+>>> batch.add(2, 3)
+>>> batch._notify.add(3, 5)
+>>> batch()
+[53, 5]
+
+See https://github.com/tcalmant/jsonrpclib for more info.
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+# Library includes
+import jsonrpclib.config
+import jsonrpclib.utils as utils
+
+# Standard library
+import contextlib
+import logging
+import sys
+import uuid
+
+# Create the logger
+_logger = logging.getLogger(__name__)
+
+try:
+ # Python 3
+ # pylint: disable=F0401,E0611
+ from urllib.parse import splittype
+ from urllib.parse import splithost
+ from xmlrpc.client import Transport as XMLTransport
+ from xmlrpc.client import SafeTransport as XMLSafeTransport
+ from xmlrpc.client import ServerProxy as XMLServerProxy
+ from xmlrpc.client import _Method as XML_Method
+
+except ImportError:
+ # Python 2
+ # pylint: disable=F0401,E0611
+ from urllib import splittype
+ from urllib import splithost
+ from xmlrpclib import Transport as XMLTransport
+ from xmlrpclib import SafeTransport as XMLSafeTransport
+ from xmlrpclib import ServerProxy as XMLServerProxy
+ from xmlrpclib import _Method as XML_Method
+
+# ------------------------------------------------------------------------------
+# JSON library import
+
+# JSON class serialization
+from jsonrpclib import jsonclass
+
+try:
+ # pylint: disable=F0401,E0611
+ # Using cjson
+ import cjson
+ _logger.debug("Using cjson as JSON library")
+
+ # Declare cjson methods
+ def jdumps(obj, encoding='utf-8'):
+ """
+ Serializes ``obj`` to a JSON formatted string, using cjson.
+ """
+ return cjson.encode(obj)
+
+ def jloads(json_string):
+ """
+ Deserializes ``json_string`` (a string containing a JSON document)
+ to a Python object, using cjson.
+ """
+ return cjson.decode(json_string)
+
+except ImportError:
+ # pylint: disable=F0401,E0611
+ # Use json or simplejson
+ try:
+ import json
+ _logger.debug("Using json as JSON library")
+
+ except ImportError:
+ try:
+ import simplejson as json
+ _logger.debug("Using simplejson as JSON library")
+ except ImportError:
+ _logger.error("No supported JSON library found")
+ raise ImportError('You must have the cjson, json, or simplejson '
+ 'module(s) available.')
+
+ # Declare json methods
+ if sys.version_info[0] < 3:
+ def jdumps(obj, encoding='utf-8'):
+ """
+ Serializes ``obj`` to a JSON formatted string.
+ """
+ # Python 2 (explicit encoding)
+ return json.dumps(obj, encoding=encoding)
+
+ else:
+ # Python 3
+ def jdumps(obj, encoding='utf-8'):
+ """
+ Serializes ``obj`` to a JSON formatted string.
+ """
+ # Python 3 (the encoding parameter has been removed)
+ return json.dumps(obj)
+
+ def jloads(json_string):
+ """
+ Deserializes ``json_string`` (a string containing a JSON document)
+ to a Python object.
+ """
+ return json.loads(json_string)
+
+# ------------------------------------------------------------------------------
+# XMLRPClib re-implementations
+
+
+class ProtocolError(Exception):
+ """
+ JSON-RPC error
+
+ ProtocolError.args[0] can be:
+ * an error message (string)
+ * a (code, message) tuple
+ """
+ pass
+
+
+class AppError(ProtocolError):
+ """
+ Application error: the error code is not in the pre-defined ones
+
+ AppError.args[0][0]: Error code
+ AppError.args[0][1]: Error message or trace
+ AppError.args[0][2]: Associated data
+ """
+ def data(self):
+ """
+ Retrieves the value found in the 'data' entry of the error, or None
+
+ :return: The data associated to the error, or None
+ """
+ return self.args[0][2]
+
+
+class JSONParser(object):
+ """
+ Default JSON parser
+ """
+ def __init__(self, target):
+ """
+ Associates the target loader to the parser
+
+ :param target: a JSONTarget instance
+ """
+ self.target = target
+
+ def feed(self, data):
+ """
+ Feeds the associated target with the given data
+ """
+ self.target.feed(data)
+
+ def close(self):
+ """
+ Does nothing
+ """
+ pass
+
+
+class JSONTarget(object):
+ """
+ Unmarshalls stream data to a string
+ """
+ def __init__(self):
+ """
+ Sets up the unmarshaller
+ """
+ self.data = []
+
+ def feed(self, data):
+ """
+ Stores the given raw data into a buffer
+ """
+ # Store raw data as it might not contain whole wide-character
+ self.data.append(data)
+
+ def close(self):
+ """
+ Unmarshalls the buffered data
+ """
+ if not self.data:
+ return ''
+ else:
+ # Use type to have a valid join (str vs. bytes)
+ data = type(self.data[0])().join(self.data)
+ try:
+ # Convert the whole final string
+ data = utils.from_bytes(data)
+ except:
+ # Try a pass-through
+ pass
+
+ return data
+
+
+class TransportMixIn(object):
+ """ Just extends the XMLRPC transport where necessary. """
+ # for Python 2.7 support
+ _connection = None
+
+ # List of non-overridable headers
+ # Use the configuration to change the content-type
+ readonly_headers = ('content-length', 'content-type')
+
+ def __init__(self, config=jsonrpclib.config.DEFAULT, context=None):
+ """
+ Sets up the transport
+
+ :param config: A JSONRPClib Config instance
+ """
+ # Store the configuration
+ self._config = config
+
+ # Store the SSL context
+ self.context = context
+
+ # Set up the user agent
+ self.user_agent = config.user_agent
+
+ # Additional headers: list of dictionaries
+ self.additional_headers = []
+
+ def push_headers(self, headers):
+ """
+ Adds a dictionary of headers to the additional headers list
+
+ :param headers: A dictionary
+ """
+ self.additional_headers.append(headers)
+
+ def pop_headers(self, headers):
+ """
+ Removes the given dictionary from the additional headers list.
+ Also validates that given headers are on top of the stack
+
+ :param headers: Headers to remove
+ :raise AssertionError: The given dictionary is not on the latest stored
+ in the additional headers list
+ """
+ assert self.additional_headers[-1] == headers
+ self.additional_headers.pop()
+
+ def emit_additional_headers(self, connection):
+ """
+ Puts headers as is in the request, filtered read only headers
+
+ :param connection: The request connection
+ """
+ additional_headers = {}
+
+ # Prepare the merged dictionary
+ for headers in self.additional_headers:
+ additional_headers.update(headers)
+
+ # Remove forbidden keys
+ for forbidden in self.readonly_headers:
+ additional_headers.pop(forbidden, None)
+
+ # Reversed order: in the case of multiple headers value definition,
+ # the latest pushed has priority
+ for key, value in additional_headers.items():
+ key = str(key)
+ if key.lower() not in self.readonly_headers:
+ # Only accept replaceable headers
+ connection.putheader(str(key), str(value))
+
+ def send_content(self, connection, request_body):
+ """
+ Completes the request headers and sends the request body of a JSON-RPC
+ request over a HTTPConnection
+
+ :param connection: An HTTPConnection object
+ :param request_body: JSON-RPC request body
+ """
+ # Convert the body first
+ request_body = utils.to_bytes(request_body)
+
+ # "static" headers
+ connection.putheader("Content-Type", self._config.content_type)
+ connection.putheader("Content-Length", str(len(request_body)))
+
+ # Emit additional headers here in order not to override content-length
+ self.emit_additional_headers(connection)
+
+ connection.endheaders()
+ if request_body:
+ connection.send(request_body)
+
+ def getparser(self):
+ """
+ Create an instance of the parser, and attach it to an unmarshalling
+ object. Return both objects.
+
+ :return: The parser and unmarshaller instances
+ """
+ target = JSONTarget()
+ return JSONParser(target), target
+
+
+class Transport(TransportMixIn, XMLTransport):
+ """
+ Mixed-in HTTP transport
+ """
+ pass
+
+
+class SafeTransport(TransportMixIn, XMLSafeTransport):
+ """
+ Mixed-in HTTPS transport
+ """
+ pass
+
+# ------------------------------------------------------------------------------
+
+
+class ServerProxy(XMLServerProxy):
+ """
+ Unfortunately, much more of this class has to be copied since
+ so much of it does the serialization.
+ """
+ def __init__(self, uri, transport=None, encoding=None,
+ verbose=0, version=None, headers=None, history=None,
+ config=jsonrpclib.config.DEFAULT, context=None):
+ """
+ Sets up the server proxy
+
+ :param uri: Request URI
+ :param transport: Custom transport handler
+ :param encoding: Specified encoding
+ :param verbose: Log verbosity level
+ :param version: JSON-RPC specification version
+ :param headers: Custom additional headers for each request
+ :param history: History object (for tests)
+ :param config: A JSONRPClib Config instance
+ :param context: The optional SSLContext to use
+ """
+ # Store the configuration
+ self._config = config
+ self.__version = version or config.version
+
+ schema, uri = splittype(uri)
+ if schema not in ('http', 'https'):
+ _logger.error("jsonrpclib only support http(s) URIs, not %s",
+ schema)
+ raise IOError('Unsupported JSON-RPC protocol.')
+
+ self.__host, self.__handler = splithost(uri)
+ if not self.__handler:
+ # Not sure if this is in the JSON spec?
+ self.__handler = '/'
+
+ if transport is None:
+ if schema == 'https':
+ transport = SafeTransport(config=config, context=context)
+ else:
+ transport = Transport(config=config)
+ self.__transport = transport
+
+ self.__encoding = encoding
+ self.__verbose = verbose
+ self.__history = history
+
+ # Global custom headers are injected into Transport
+ self.__transport.push_headers(headers or {})
+
+ def _request(self, methodname, params, rpcid=None):
+ """
+ Calls a method on the remote server
+
+ :param methodname: Name of the method to call
+ :param params: Method parameters
+ :param rpcid: ID of the remote call
+ :return: The parsed result of the call
+ """
+ request = dumps(params, methodname, encoding=self.__encoding,
+ rpcid=rpcid, version=self.__version,
+ config=self._config)
+ response = self._run_request(request)
+ check_for_errors(response)
+ return response['result']
+
+ def _request_notify(self, methodname, params, rpcid=None):
+ """
+ Calls a method as a notification
+
+ :param methodname: Name of the method to call
+ :param params: Method parameters
+ :param rpcid: ID of the remote call
+ """
+ request = dumps(params, methodname, encoding=self.__encoding,
+ rpcid=rpcid, version=self.__version, notify=True,
+ config=self._config)
+ response = self._run_request(request, notify=True)
+ check_for_errors(response)
+
+ def _run_request(self, request, notify=False):
+ """
+ Sends the given request to the remote server
+
+ :param request: The request to send
+ :param notify: Notification request flag (unused)
+ :return: The response as a parsed JSON object
+ """
+ if self.__history is not None:
+ self.__history.add_request(request)
+
+ response = self.__transport.request(
+ self.__host,
+ self.__handler,
+ request,
+ verbose=self.__verbose
+ )
+
+ # Here, the XMLRPC library translates a single list
+ # response to the single value -- should we do the
+ # same, and require a tuple / list to be passed to
+ # the response object, or expect the Server to be
+ # outputting the response appropriately?
+
+ if self.__history is not None:
+ self.__history.add_response(response)
+
+ if not response:
+ return None
+ else:
+ return_obj = loads(response, self._config)
+ return return_obj
+
+ def __getattr__(self, name):
+ """
+ Returns a callable object to call the remote service
+ """
+ # Same as original, just with new _Method reference
+ return _Method(self._request, name)
+
+ def __close(self):
+ """
+ Closes the transport layer
+ """
+ try:
+ self.__transport.close()
+ except AttributeError:
+ # Not available in Python 2.6
+ pass
+
+ def __call__(self, attr):
+ """
+ A workaround to get special attributes on the ServerProxy
+ without interfering with the magic __getattr__
+
+ (code from xmlrpclib in Python 2.7)
+ """
+ if attr == "close":
+ return self.__close
+
+ elif attr == "transport":
+ return self.__transport
+
+ raise AttributeError("Attribute {0} not found".format(attr))
+
+ @property
+ def _notify(self):
+ """
+ Like __getattr__, but sending a notification request instead of a call
+ """
+ return _Notify(self._request_notify)
+
+ @contextlib.contextmanager
+ def _additional_headers(self, headers):
+ """
+ Allows to specify additional headers, to be added inside the with
+ block.
+ Example of usage:
+
+ >>> with client._additional_headers({'X-Test' : 'Test'}) as new_client:
+ ... new_client.method()
+ ...
+ >>> # Here old headers are restored
+ """
+ self.__transport.push_headers(headers)
+ yield self
+ self.__transport.pop_headers(headers)
+
+# ------------------------------------------------------------------------------
+
+
+class _Method(XML_Method):
+ """
+ Some magic to bind an JSON-RPC method to an RPC server.
+ """
+ def __call__(self, *args, **kwargs):
+ """
+ Sends an RPC request and returns the unmarshalled result
+ """
+ if args and kwargs:
+ raise ProtocolError("Cannot use both positional and keyword "
+ "arguments (according to JSON-RPC spec.)")
+ if args:
+ return self.__send(self.__name, args)
+ else:
+ return self.__send(self.__name, kwargs)
+
+ def __getattr__(self, name):
+ """
+ Returns a Method object for nested calls
+ """
+ if name == "__name__":
+ return self.__name
+ return _Method(self.__send, "{0}.{1}".format(self.__name, name))
+
+
+class _Notify(object):
+ """
+ Same as _Method, but to send notifications
+ """
+ def __init__(self, request):
+ """
+ Sets the method to call to send a request to the server
+ """
+ self._request = request
+
+ def __getattr__(self, name):
+ """
+ Returns a Method object, to be called as a notification
+ """
+ return _Method(self._request, name)
+
+# ------------------------------------------------------------------------------
+# Batch implementation
+
+
+class MultiCallMethod(object):
+ """
+ Stores calls made to a MultiCall object for batch execution
+ """
+ def __init__(self, method, notify=False, config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the store
+
+ :param method: Name of the method to call
+ :param notify: Notification flag
+ :param config: Request configuration
+ """
+ self.method = method
+ self.params = []
+ self.notify = notify
+ self._config = config
+
+ def __call__(self, *args, **kwargs):
+ """
+ Normalizes call parameters
+ """
+ if kwargs and args:
+ raise ProtocolError('JSON-RPC does not support both ' +
+ 'positional and keyword arguments.')
+ if kwargs:
+ self.params = kwargs
+ else:
+ self.params = args
+
+ def request(self, encoding=None, rpcid=None):
+ """
+ Returns the request object as JSON-formatted string
+ """
+ return dumps(self.params, self.method, version=2.0,
+ encoding=encoding, rpcid=rpcid, notify=self.notify,
+ config=self._config)
+
+ def __repr__(self):
+ """
+ String representation
+ """
+ return str(self.request())
+
+ def __getattr__(self, method):
+ """
+ Updates the object for a nested call
+ """
+ self.method = "{0}.{1}".format(self.method, method)
+ return self
+
+
+class MultiCallNotify(object):
+ """
+ Same as MultiCallMethod but for notifications
+ """
+ def __init__(self, multicall, config=jsonrpclib.config.DEFAULT):
+ """
+ Sets ip the store
+
+ :param multicall: The parent MultiCall instance
+ :param config: Request configuration
+ """
+ self.multicall = multicall
+ self._config = config
+
+ def __getattr__(self, name):
+ """
+ Returns the MultiCallMethod to use as a notification
+ """
+ new_job = MultiCallMethod(name, notify=True, config=self._config)
+ self.multicall._job_list.append(new_job)
+ return new_job
+
+
+class MultiCallIterator(object):
+ """
+ Iterates over the results of a MultiCall.
+ Exceptions are raised in response to JSON-RPC faults
+ """
+ def __init__(self, results):
+ """
+ Sets up the results store
+ """
+ self.results = results
+
+ def __get_result(self, item):
+ """
+ Checks for error and returns the "real" result stored in a MultiCall
+ result.
+ """
+ check_for_errors(item)
+ return item['result']
+
+ def __iter__(self):
+ """
+ Iterates over all results
+ """
+ for item in self.results:
+ yield self.__get_result(item)
+ raise StopIteration
+
+ def __getitem__(self, i):
+ """
+ Returns the i-th object of the results
+ """
+ return self.__get_result(self.results[i])
+
+ def __len__(self):
+ """
+ Returns the number of results stored
+ """
+ return len(self.results)
+
+
+class MultiCall(object):
+ """
+ server -> a object used to boxcar method calls, where server should be a
+ ServerProxy object.
+
+ Methods can be added to the MultiCall using normal
+ method call syntax e.g.:
+
+ multicall = MultiCall(server_proxy)
+ multicall.add(2,3)
+ multicall.get_address("Guido")
+
+ To execute the multicall, call the MultiCall object e.g.:
+
+ add_result, address = multicall()
+ """
+ def __init__(self, server, config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the multicall
+
+ :param server: A ServerProxy object
+ :param config: Request configuration
+ """
+ self._server = server
+ self._job_list = []
+ self._config = config
+
+ def _request(self):
+ """
+ Sends the request to the server and returns the responses
+
+ :return: A MultiCallIterator object
+ """
+ if len(self._job_list) < 1:
+ # Should we alert? This /is/ pretty obvious.
+ return
+ request_body = "[ {0} ]".format(
+ ','.join(job.request() for job in self._job_list))
+ responses = self._server._run_request(request_body)
+ del self._job_list[:]
+ if not responses:
+ responses = []
+ return MultiCallIterator(responses)
+
+ @property
+ def _notify(self):
+ """
+ Prepares a notification call
+ """
+ return MultiCallNotify(self, self._config)
+
+ def __getattr__(self, name):
+ """
+ Registers a method call
+ """
+ new_job = MultiCallMethod(name, config=self._config)
+ self._job_list.append(new_job)
+ return new_job
+
+ __call__ = _request
+
+# These lines conform to xmlrpclib's "compatibility" line.
+# Not really sure if we should include these, but oh well.
+Server = ServerProxy
+
+# ------------------------------------------------------------------------------
+
+
+class Fault(object):
+ """
+ JSON-RPC error class
+ """
+ def __init__(self, code=-32000, message='Server error', rpcid=None,
+ config=jsonrpclib.config.DEFAULT, data=None):
+ """
+ Sets up the error description
+
+ :param code: Fault code
+ :param message: Associated message
+ :param rpcid: Request ID
+ :param config: A JSONRPClib Config instance
+ :param data: Extra information added to an error description
+ """
+ self.faultCode = code
+ self.faultString = message
+ self.rpcid = rpcid
+ self.config = config
+ self.data = data
+
+ def error(self):
+ """
+ Returns the error as a dictionary
+
+ :returns: A {'code', 'message'} dictionary
+ """
+ return {'code': self.faultCode, 'message': self.faultString,
+ 'data': self.data}
+
+ def response(self, rpcid=None, version=None):
+ """
+ Returns the error as a JSON-RPC response string
+
+ :param rpcid: Forced request ID
+ :param version: JSON-RPC version
+ :return: A JSON-RPC response string
+ """
+ if not version:
+ version = self.config.version
+
+ if rpcid:
+ self.rpcid = rpcid
+
+ return dumps(self, methodresponse=True, rpcid=self.rpcid,
+ version=version, config=self.config)
+
+ def dump(self, rpcid=None, version=None):
+ """
+ Returns the error as a JSON-RPC response dictionary
+
+ :param rpcid: Forced request ID
+ :param version: JSON-RPC version
+ :return: A JSON-RPC response dictionary
+ """
+ if not version:
+ version = self.config.version
+
+ if rpcid:
+ self.rpcid = rpcid
+
+ return dump(self, is_response=True, rpcid=self.rpcid,
+ version=version, config=self.config)
+
+ def __repr__(self):
+ """
+ String representation
+ """
+ return '<Fault {0}: {1}>'.format(self.faultCode, self.faultString)
+
+
+class Payload(object):
+ """
+ JSON-RPC content handler
+ """
+ def __init__(self, rpcid=None, version=None,
+ config=jsonrpclib.config.DEFAULT):
+ """
+ Sets up the JSON-RPC handler
+
+ :param rpcid: Request ID
+ :param version: JSON-RPC version
+ :param config: A JSONRPClib Config instance
+ """
+ if not version:
+ version = config.version
+
+ self.id = rpcid
+ self.version = float(version)
+
+ def request(self, method, params=None):
+ """
+ Prepares a method call request
+
+ :param method: Method name
+ :param params: Method parameters
+ :return: A JSON-RPC request dictionary
+ """
+ if not isinstance(method, utils.string_types):
+ raise ValueError('Method name must be a string.')
+
+ if not self.id:
+ # Generate a request ID
+ self.id = str(uuid.uuid4())
+
+ request = {'id': self.id, 'method': method}
+ if params or self.version < 1.1:
+ request['params'] = params or []
+
+ if self.version >= 2:
+ request['jsonrpc'] = str(self.version)
+
+ return request
+
+ def notify(self, method, params=None):
+ """
+ Prepares a notification request
+
+ :param method: Notification name
+ :param params: Notification parameters
+ :return: A JSON-RPC notification dictionary
+ """
+ # Prepare the request dictionary
+ request = self.request(method, params)
+
+ # Remove the request ID, as it's a notification
+ if self.version >= 2:
+ del request['id']
+ else:
+ request['id'] = None
+
+ return request
+
+ def response(self, result=None):
+ """
+ Prepares a response dictionary
+
+ :param result: The result of method call
+ :return: A JSON-RPC response dictionary
+ """
+ response = {'result': result, 'id': self.id}
+
+ if self.version >= 2:
+ response['jsonrpc'] = str(self.version)
+ else:
+ response['error'] = None
+
+ return response
+
+ def error(self, code=-32000, message='Server error.', data=None):
+ """
+ Prepares an error dictionary
+
+ :param code: Error code
+ :param message: Error message
+ :return: A JSON-RPC error dictionary
+ """
+ error = self.response()
+ if self.version >= 2:
+ del error['result']
+ else:
+ error['result'] = None
+ error['error'] = {'code': code, 'message': message}
+ if data is not None:
+ error['error']['data'] = data
+ return error
+
+# ------------------------------------------------------------------------------
+
+
+def dump(params=None, methodname=None, rpcid=None, version=None,
+ is_response=None, is_notify=None, config=jsonrpclib.config.DEFAULT):
+ """
+ Prepares a JSON-RPC dictionary (request, notification, response or error)
+
+ :param params: Method parameters (if a method name is given) or a Fault
+ :param methodname: Method name
+ :param rpcid: Request ID
+ :param version: JSON-RPC version
+ :param is_response: If True, this is a response dictionary
+ :param is_notify: If True, this is a notification request
+ :param config: A JSONRPClib Config instance
+ :return: A JSON-RPC dictionary
+ """
+ # Default version
+ if not version:
+ version = config.version
+
+ if not is_response and params is None:
+ params = []
+
+ # Validate method name and parameters
+ valid_params = [utils.TupleType, utils.ListType, utils.DictType, Fault]
+ if is_response:
+ valid_params.append(type(None))
+
+ if isinstance(methodname, utils.string_types) and \
+ not isinstance(params, tuple(valid_params)):
+ """
+ If a method, and params are not in a listish or a Fault,
+ error out.
+ """
+ raise TypeError("Params must be a dict, list, tuple "
+ "or Fault instance.")
+
+ # Prepares the JSON-RPC content
+ payload = Payload(rpcid=rpcid, version=version)
+
+ if isinstance(params, Fault):
+ # Prepare an error dictionary
+ # pylint: disable=E1103
+ return payload.error(params.faultCode, params.faultString, params.data)
+
+ if not isinstance(methodname, utils.string_types) and not is_response:
+ # Neither a request nor a response
+ raise ValueError('Method name must be a string, or is_response '
+ 'must be set to True.')
+
+ if config.use_jsonclass:
+ # Use jsonclass to convert the parameters
+ params = jsonclass.dump(params, config=config)
+
+ if is_response:
+ # Prepare a response dictionary
+ if rpcid is None:
+ # A response must have a request ID
+ raise ValueError('A method response must have an rpcid.')
+ return payload.response(params)
+
+ if is_notify:
+ # Prepare a notification dictionary
+ return payload.notify(methodname, params)
+ else:
+ # Prepare a method call dictionary
+ return payload.request(methodname, params)
+
+
+def dumps(params=None, methodname=None, methodresponse=None,
+ encoding=None, rpcid=None, version=None, notify=None,
+ config=jsonrpclib.config.DEFAULT):
+ """
+ Prepares a JSON-RPC request/response string
+
+ :param params: Method parameters (if a method name is given) or a Fault
+ :param methodname: Method name
+ :param methodresponse: If True, this is a response dictionary
+ :param encoding: Result string encoding
+ :param rpcid: Request ID
+ :param version: JSON-RPC version
+ :param notify: If True, this is a notification request
+ :param config: A JSONRPClib Config instance
+ :return: A JSON-RPC dictionary
+ """
+ # Prepare the dictionary
+ request = dump(params, methodname, rpcid, version, methodresponse, notify,
+ config)
+
+ # Returns it as a JSON string
+ return jdumps(request, encoding=encoding or "UTF-8")
+
+
+def load(data, config=jsonrpclib.config.DEFAULT):
+ """
+ Loads a JSON-RPC request/response dictionary. Calls jsonclass to load beans
+
+ :param data: A JSON-RPC dictionary
+ :param config: A JSONRPClib Config instance (or None for default values)
+ :return: A parsed dictionary or None
+ """
+ if data is None:
+ # Notification
+ return None
+
+ # if the above raises an error, the implementing server code
+ # should return something like the following:
+ # { 'jsonrpc':'2.0', 'error': fault.error(), id: None }
+ if config.use_jsonclass:
+ # Convert beans
+ data = jsonclass.load(data, config.classes)
+
+ return data
+
+
+def loads(data, config=jsonrpclib.config.DEFAULT):
+ """
+ Loads a JSON-RPC request/response string. Calls jsonclass to load beans
+
+ :param data: A JSON-RPC string
+ :param config: A JSONRPClib Config instance (or None for default values)
+ :return: A parsed dictionary or None
+ """
+ if data == '':
+ # Notification
+ return None
+
+ # Parse the JSON dictionary
+ result = jloads(data)
+
+ # Load the beans
+ return load(result, config)
+
+# ------------------------------------------------------------------------------
+
+
+def check_for_errors(result):
+ """
+ Checks if a result dictionary signals an error
+
+ :param result: A result dictionary
+ :raise TypeError: Invalid parameter
+ :raise NotImplementedError: Unknown JSON-RPC version
+ :raise ValueError: Invalid dictionary content
+ :raise ProtocolError: An error occurred on the server side
+ :return: The result parameter
+ """
+ if not result:
+ # Notification
+ return result
+
+ if not isinstance(result, utils.DictType):
+ # Invalid argument
+ raise TypeError('Response is not a dict.')
+
+ if 'jsonrpc' in result and float(result['jsonrpc']) > 2.0:
+ # Unknown JSON-RPC version
+ raise NotImplementedError('JSON-RPC version not yet supported.')
+
+ if 'result' not in result and 'error' not in result:
+ # Invalid dictionary content
+ raise ValueError('Response does not have a result or error key.')
+
+ if 'error' in result and result['error']:
+ # Server-side error
+ if 'code' in result['error']:
+ # Code + Message
+ code = result['error']['code']
+ try:
+ # Get the message (jsonrpclib)
+ message = result['error']['message']
+ except KeyError:
+ # Get the trace (jabsorb)
+ message = result['error'].get('trace', '<no error message>')
+
+ if -32700 <= code <= -32000:
+ # Pre-defined errors
+ # See http://www.jsonrpc.org/specification#error_object
+ raise ProtocolError((code, message))
+ else:
+ # Application error
+ data = result['error'].get('data', None)
+ raise AppError((code, message, data))
+
+ elif isinstance(result['error'], dict) and len(result['error']) == 1:
+ # Error with a single entry ('reason', ...): use its content
+ error_key = result['error'].keys()[0]
+ raise ProtocolError(result['error'][error_key])
+
+ else:
+ # Use the raw error content
+ raise ProtocolError(result['error'])
+
+ return result
+
+
+def isbatch(request):
+ """
+ Tests if the given request is a batch call, i.e. a list of multiple calls
+ :param request: a JSON-RPC request object
+ :return: True if the request is a batch call
+ """
+ if not isinstance(request, (utils.ListType, utils.TupleType)):
+ # Not a list: not a batch call
+ return False
+ elif len(request) < 1:
+ # Only one request: not a batch call
+ return False
+ elif not isinstance(request[0], utils.DictType):
+ # One of the requests is not a dictionary, i.e. a JSON Object
+ # therefore it is not a valid JSON-RPC request
+ return False
+ elif 'jsonrpc' not in request[0].keys():
+ # No "jsonrpc" version in the JSON object: not a request
+ return False
+
+ try:
+ version = float(request[0]['jsonrpc'])
+ except ValueError:
+ # Bad version of JSON-RPC
+ raise ProtocolError('"jsonrpc" key must be a float(able) value.')
+
+ if version < 2:
+ # Batch call were not supported before JSON-RPC 2.0
+ return False
+
+ return True
+
+
+def isnotification(request):
+ """
+ Tests if the given request is a notification
+
+ :param request: A request dictionary
+ :return: True if the request is a notification
+ """
+ if 'id' not in request:
+ # 2.0 notification
+ return True
+
+ if request['id'] is None:
+ # 1.0 notification
+ return True
+
+ return False
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py
index 3919c105..a38b5b83 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/threadpool.py
@@ -1,490 +1,490 @@
-#!/usr/bin/env python
-# -- Content-Encoding: UTF-8 --
-"""
-Cached thread pool, inspired from Pelix/iPOPO Thread Pool
-
-:author: Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# ------------------------------------------------------------------------------
-
-# Standard library
-import logging
-import threading
-
-try:
- # Python 3
- # pylint: disable=F0401
- import queue
-except ImportError:
- # Python 2
- # pylint: disable=F0401
- import Queue as queue
-
-# ------------------------------------------------------------------------------
-
-
-class EventData(object):
- """
- A threading event with some associated data
- """
- def __init__(self):
- """
- Sets up the event
- """
- self.__event = threading.Event()
- self.__data = None
- self.__exception = None
-
- @property
- def data(self):
- """
- Returns the associated value
- """
- return self.__data
-
- @property
- def exception(self):
- """
- Returns the exception used to stop the wait() method
- """
- return self.__exception
-
- def clear(self):
- """
- Clears the event
- """
- self.__event.clear()
- self.__data = None
- self.__exception = None
-
- def is_set(self):
- """
- Checks if the event is set
- """
- return self.__event.is_set()
-
- def set(self, data=None):
- """
- Sets the event
- """
- self.__data = data
- self.__exception = None
- self.__event.set()
-
- def raise_exception(self, exception):
- """
- Raises an exception in wait()
-
- :param exception: An Exception object
- """
- self.__data = None
- self.__exception = exception
- self.__event.set()
-
- def wait(self, timeout=None):
- """
- Waits for the event or for the timeout
-
- :param timeout: Wait timeout (in seconds)
- :return: True if the event as been set, else False
- """
- # The 'or' part is for Python 2.6
- result = self.__event.wait(timeout) or self.__event.is_set()
- # pylint: disable=E0702
- # Pylint seems to miss the "is None" check below
- if self.__exception is None:
- return result
- else:
- raise self.__exception
-
-
-class FutureResult(object):
- """
- An object to wait for the result of a threaded execution
- """
- def __init__(self, logger=None):
- """
- Sets up the FutureResult object
-
- :param logger: The Logger to use in case of error (optional)
- """
- self._logger = logger or logging.getLogger(__name__)
- self._done_event = EventData()
- self.__callback = None
- self.__extra = None
-
- def __notify(self):
- """
- Notify the given callback about the result of the execution
- """
- if self.__callback is not None:
- try:
- self.__callback(self._done_event.data,
- self._done_event.exception,
- self.__extra)
- except Exception as ex:
- self._logger.exception("Error calling back method: %s", ex)
-
- def set_callback(self, method, extra=None):
- """
- Sets a callback method, called once the result has been computed or in
- case of exception.
-
- The callback method must have the following signature:
- ``callback(result, exception, extra)``.
-
- :param method: The method to call back in the end of the execution
- :param extra: Extra parameter to be given to the callback method
- """
- self.__callback = method
- self.__extra = extra
- if self._done_event.is_set():
- # The execution has already finished
- self.__notify()
-
- def execute(self, method, args, kwargs):
- """
- Execute the given method and stores its result.
- The result is considered "done" even if the method raises an exception
-
- :param method: The method to execute
- :param args: Method positional arguments
- :param kwargs: Method keyword arguments
- :raise Exception: The exception raised by the method
- """
- # Normalize arguments
- if args is None:
- args = []
-
- if kwargs is None:
- kwargs = {}
-
- try:
- # Call the method
- result = method(*args, **kwargs)
- except Exception as ex:
- # Something went wrong: propagate to the event and to the caller
- self._done_event.raise_exception(ex)
- raise
- else:
- # Store the result
- self._done_event.set(result)
- finally:
- # In any case: notify the call back (if any)
- self.__notify()
-
- def done(self):
- """
- Returns True if the job has finished, else False
- """
- return self._done_event.is_set()
-
- def result(self, timeout=None):
- """
- Waits up to timeout for the result the threaded job.
- Returns immediately the result if the job has already been done.
-
- :param timeout: The maximum time to wait for a result (in seconds)
- :raise OSError: The timeout raised before the job finished
- :raise Exception: The exception encountered during the call, if any
- """
- if self._done_event.wait(timeout):
- return self._done_event.data
- else:
- raise OSError("Timeout raised")
-
-# ------------------------------------------------------------------------------
-
-
-class ThreadPool(object):
- """
- Executes the tasks stored in a FIFO in a thread pool
- """
- def __init__(self, max_threads, min_threads=1, queue_size=0, timeout=60,
- logname=None):
- """
- Sets up the thread pool.
-
- Threads are kept alive 60 seconds (timeout argument).
-
- :param max_threads: Maximum size of the thread pool
- :param min_threads: Minimum size of the thread pool
- :param queue_size: Size of the task queue (0 for infinite)
- :param timeout: Queue timeout (in seconds, 60s by default)
- :param logname: Name of the logger
- :raise ValueError: Invalid number of threads
- """
- # Validate parameters
- try:
- max_threads = int(max_threads)
- if max_threads < 1:
- raise ValueError("Pool size must be greater than 0")
- except (TypeError, ValueError) as ex:
- raise ValueError("Invalid pool size: {0}".format(ex))
-
- try:
- min_threads = int(min_threads)
- if min_threads < 0:
- min_threads = 0
- elif min_threads > max_threads:
- min_threads = max_threads
- except (TypeError, ValueError) as ex:
- raise ValueError("Invalid pool size: {0}".format(ex))
-
- # The logger
- self._logger = logging.getLogger(logname or __name__)
-
- # The loop control event
- self._done_event = threading.Event()
- self._done_event.set()
-
- # The task queue
- try:
- queue_size = int(queue_size)
- except (TypeError, ValueError):
- # Not a valid integer
- queue_size = 0
-
- self._queue = queue.Queue(queue_size)
- self._timeout = timeout
- self.__lock = threading.RLock()
-
- # The thread pool
- self._min_threads = min_threads
- self._max_threads = max_threads
- self._threads = []
-
- # Thread count
- self._thread_id = 0
-
- # Current number of threads, active and alive
- self.__nb_threads = 0
- self.__nb_active_threads = 0
-
- def start(self):
- """
- Starts the thread pool. Does nothing if the pool is already started.
- """
- if not self._done_event.is_set():
- # Stop event not set: we're running
- return
-
- # Clear the stop event
- self._done_event.clear()
-
- # Compute the number of threads to start to handle pending tasks
- nb_pending_tasks = self._queue.qsize()
- if nb_pending_tasks > self._max_threads:
- nb_threads = self._max_threads
- elif nb_pending_tasks < self._min_threads:
- nb_threads = self._min_threads
- else:
- nb_threads = nb_pending_tasks
-
- # Create the threads
- for _ in range(nb_threads):
- self.__start_thread()
-
- def __start_thread(self):
- """
- Starts a new thread, if possible
- """
- with self.__lock:
- if self.__nb_threads >= self._max_threads:
- # Can't create more threads
- return False
-
- if self._done_event.is_set():
- # We're stopped: do nothing
- return False
-
- # Prepare thread and start it
- name = "{0}-{1}".format(self._logger.name, self._thread_id)
- self._thread_id += 1
-
- thread = threading.Thread(target=self.__run, name=name)
- thread.daemon = True
- self._threads.append(thread)
- thread.start()
- return True
-
- def stop(self):
- """
- Stops the thread pool. Does nothing if the pool is already stopped.
- """
- if self._done_event.is_set():
- # Stop event set: we're stopped
- return
-
- # Set the stop event
- self._done_event.set()
-
- with self.__lock:
- # Add something in the queue (to unlock the join())
- try:
- for _ in self._threads:
- self._queue.put(self._done_event, True, self._timeout)
- except queue.Full:
- # There is already something in the queue
- pass
-
- # Copy the list of threads to wait for
- threads = self._threads[:]
-
- # Join threads outside the lock
- for thread in threads:
- while thread.is_alive():
- # Wait 3 seconds
- thread.join(3)
- if thread.is_alive():
- # Thread is still alive: something might be wrong
- self._logger.warning("Thread %s is still alive...",
- thread.name)
-
- # Clear storage
- del self._threads[:]
- self.clear()
-
- def enqueue(self, method, *args, **kwargs):
- """
- Queues a task in the pool
-
- :param method: Method to call
- :return: A FutureResult object, to get the result of the task
- :raise ValueError: Invalid method
- :raise Full: The task queue is full
- """
- if not hasattr(method, '__call__'):
- raise ValueError("{0} has no __call__ member."
- .format(method.__name__))
-
- # Prepare the future result object
- future = FutureResult(self._logger)
-
- # Use a lock, as we might be "resetting" the queue
- with self.__lock:
- # Add the task to the queue
- self._queue.put((method, args, kwargs, future), True,
- self._timeout)
-
- if self.__nb_active_threads == self.__nb_threads:
- # All threads are taken: start a new one
- self.__start_thread()
-
- return future
-
- def clear(self):
- """
- Empties the current queue content.
- Returns once the queue have been emptied.
- """
- with self.__lock:
- # Empty the current queue
- try:
- while True:
- self._queue.get_nowait()
- self._queue.task_done()
- except queue.Empty:
- # Queue is now empty
- pass
-
- # Wait for the tasks currently executed
- self.join()
-
- def join(self, timeout=None):
- """
- Waits for all the tasks to be executed
-
- :param timeout: Maximum time to wait (in seconds)
- :return: True if the queue has been emptied, else False
- """
- if self._queue.empty():
- # Nothing to wait for...
- return True
- elif timeout is None:
- # Use the original join
- self._queue.join()
- return True
- else:
- # Wait for the condition
- with self._queue.all_tasks_done:
- self._queue.all_tasks_done.wait(timeout)
- return not bool(self._queue.unfinished_tasks)
-
- def __run(self):
- """
- The main loop
- """
- with self.__lock:
- self.__nb_threads += 1
-
- while not self._done_event.is_set():
- try:
- # Wait for an action (blocking)
- task = self._queue.get(True, self._timeout)
- if task is self._done_event:
- # Stop event in the queue: get out
- self._queue.task_done()
- with self.__lock:
- self.__nb_threads -= 1
- return
- except queue.Empty:
- # Nothing to do yet
- pass
- else:
- with self.__lock:
- self.__nb_active_threads += 1
-
- # Extract elements
- method, args, kwargs, future = task
- try:
- # Call the method
- future.execute(method, args, kwargs)
- except Exception as ex:
- self._logger.exception("Error executing %s: %s",
- method.__name__, ex)
- finally:
- # Mark the action as executed
- self._queue.task_done()
-
- # Thread is not active anymore
- self.__nb_active_threads -= 1
-
- # Clean up thread if necessary
- with self.__lock:
- if self.__nb_threads > self._min_threads:
- # No more work for this thread, and we're above the
- # minimum number of threads: stop this one
- self.__nb_threads -= 1
- return
-
- with self.__lock:
- # Thread stops
- self.__nb_threads -= 1
+#!/usr/bin/env python
+# -- Content-Encoding: UTF-8 --
+"""
+Cached thread pool, inspired from Pelix/iPOPO Thread Pool
+
+:author: Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# ------------------------------------------------------------------------------
+
+# Standard library
+import logging
+import threading
+
+try:
+ # Python 3
+ # pylint: disable=F0401
+ import queue
+except ImportError:
+ # Python 2
+ # pylint: disable=F0401
+ import Queue as queue
+
+# ------------------------------------------------------------------------------
+
+
+class EventData(object):
+ """
+ A threading event with some associated data
+ """
+ def __init__(self):
+ """
+ Sets up the event
+ """
+ self.__event = threading.Event()
+ self.__data = None
+ self.__exception = None
+
+ @property
+ def data(self):
+ """
+ Returns the associated value
+ """
+ return self.__data
+
+ @property
+ def exception(self):
+ """
+ Returns the exception used to stop the wait() method
+ """
+ return self.__exception
+
+ def clear(self):
+ """
+ Clears the event
+ """
+ self.__event.clear()
+ self.__data = None
+ self.__exception = None
+
+ def is_set(self):
+ """
+ Checks if the event is set
+ """
+ return self.__event.is_set()
+
+ def set(self, data=None):
+ """
+ Sets the event
+ """
+ self.__data = data
+ self.__exception = None
+ self.__event.set()
+
+ def raise_exception(self, exception):
+ """
+ Raises an exception in wait()
+
+ :param exception: An Exception object
+ """
+ self.__data = None
+ self.__exception = exception
+ self.__event.set()
+
+ def wait(self, timeout=None):
+ """
+ Waits for the event or for the timeout
+
+ :param timeout: Wait timeout (in seconds)
+ :return: True if the event as been set, else False
+ """
+ # The 'or' part is for Python 2.6
+ result = self.__event.wait(timeout) or self.__event.is_set()
+ # pylint: disable=E0702
+ # Pylint seems to miss the "is None" check below
+ if self.__exception is None:
+ return result
+ else:
+ raise self.__exception
+
+
+class FutureResult(object):
+ """
+ An object to wait for the result of a threaded execution
+ """
+ def __init__(self, logger=None):
+ """
+ Sets up the FutureResult object
+
+ :param logger: The Logger to use in case of error (optional)
+ """
+ self._logger = logger or logging.getLogger(__name__)
+ self._done_event = EventData()
+ self.__callback = None
+ self.__extra = None
+
+ def __notify(self):
+ """
+ Notify the given callback about the result of the execution
+ """
+ if self.__callback is not None:
+ try:
+ self.__callback(self._done_event.data,
+ self._done_event.exception,
+ self.__extra)
+ except Exception as ex:
+ self._logger.exception("Error calling back method: %s", ex)
+
+ def set_callback(self, method, extra=None):
+ """
+ Sets a callback method, called once the result has been computed or in
+ case of exception.
+
+ The callback method must have the following signature:
+ ``callback(result, exception, extra)``.
+
+ :param method: The method to call back in the end of the execution
+ :param extra: Extra parameter to be given to the callback method
+ """
+ self.__callback = method
+ self.__extra = extra
+ if self._done_event.is_set():
+ # The execution has already finished
+ self.__notify()
+
+ def execute(self, method, args, kwargs):
+ """
+ Execute the given method and stores its result.
+ The result is considered "done" even if the method raises an exception
+
+ :param method: The method to execute
+ :param args: Method positional arguments
+ :param kwargs: Method keyword arguments
+ :raise Exception: The exception raised by the method
+ """
+ # Normalize arguments
+ if args is None:
+ args = []
+
+ if kwargs is None:
+ kwargs = {}
+
+ try:
+ # Call the method
+ result = method(*args, **kwargs)
+ except Exception as ex:
+ # Something went wrong: propagate to the event and to the caller
+ self._done_event.raise_exception(ex)
+ raise
+ else:
+ # Store the result
+ self._done_event.set(result)
+ finally:
+ # In any case: notify the call back (if any)
+ self.__notify()
+
+ def done(self):
+ """
+ Returns True if the job has finished, else False
+ """
+ return self._done_event.is_set()
+
+ def result(self, timeout=None):
+ """
+ Waits up to timeout for the result the threaded job.
+ Returns immediately the result if the job has already been done.
+
+ :param timeout: The maximum time to wait for a result (in seconds)
+ :raise OSError: The timeout raised before the job finished
+ :raise Exception: The exception encountered during the call, if any
+ """
+ if self._done_event.wait(timeout):
+ return self._done_event.data
+ else:
+ raise OSError("Timeout raised")
+
+# ------------------------------------------------------------------------------
+
+
+class ThreadPool(object):
+ """
+ Executes the tasks stored in a FIFO in a thread pool
+ """
+ def __init__(self, max_threads, min_threads=1, queue_size=0, timeout=60,
+ logname=None):
+ """
+ Sets up the thread pool.
+
+ Threads are kept alive 60 seconds (timeout argument).
+
+ :param max_threads: Maximum size of the thread pool
+ :param min_threads: Minimum size of the thread pool
+ :param queue_size: Size of the task queue (0 for infinite)
+ :param timeout: Queue timeout (in seconds, 60s by default)
+ :param logname: Name of the logger
+ :raise ValueError: Invalid number of threads
+ """
+ # Validate parameters
+ try:
+ max_threads = int(max_threads)
+ if max_threads < 1:
+ raise ValueError("Pool size must be greater than 0")
+ except (TypeError, ValueError) as ex:
+ raise ValueError("Invalid pool size: {0}".format(ex))
+
+ try:
+ min_threads = int(min_threads)
+ if min_threads < 0:
+ min_threads = 0
+ elif min_threads > max_threads:
+ min_threads = max_threads
+ except (TypeError, ValueError) as ex:
+ raise ValueError("Invalid pool size: {0}".format(ex))
+
+ # The logger
+ self._logger = logging.getLogger(logname or __name__)
+
+ # The loop control event
+ self._done_event = threading.Event()
+ self._done_event.set()
+
+ # The task queue
+ try:
+ queue_size = int(queue_size)
+ except (TypeError, ValueError):
+ # Not a valid integer
+ queue_size = 0
+
+ self._queue = queue.Queue(queue_size)
+ self._timeout = timeout
+ self.__lock = threading.RLock()
+
+ # The thread pool
+ self._min_threads = min_threads
+ self._max_threads = max_threads
+ self._threads = []
+
+ # Thread count
+ self._thread_id = 0
+
+ # Current number of threads, active and alive
+ self.__nb_threads = 0
+ self.__nb_active_threads = 0
+
+ def start(self):
+ """
+ Starts the thread pool. Does nothing if the pool is already started.
+ """
+ if not self._done_event.is_set():
+ # Stop event not set: we're running
+ return
+
+ # Clear the stop event
+ self._done_event.clear()
+
+ # Compute the number of threads to start to handle pending tasks
+ nb_pending_tasks = self._queue.qsize()
+ if nb_pending_tasks > self._max_threads:
+ nb_threads = self._max_threads
+ elif nb_pending_tasks < self._min_threads:
+ nb_threads = self._min_threads
+ else:
+ nb_threads = nb_pending_tasks
+
+ # Create the threads
+ for _ in range(nb_threads):
+ self.__start_thread()
+
+ def __start_thread(self):
+ """
+ Starts a new thread, if possible
+ """
+ with self.__lock:
+ if self.__nb_threads >= self._max_threads:
+ # Can't create more threads
+ return False
+
+ if self._done_event.is_set():
+ # We're stopped: do nothing
+ return False
+
+ # Prepare thread and start it
+ name = "{0}-{1}".format(self._logger.name, self._thread_id)
+ self._thread_id += 1
+
+ thread = threading.Thread(target=self.__run, name=name)
+ thread.daemon = True
+ self._threads.append(thread)
+ thread.start()
+ return True
+
+ def stop(self):
+ """
+ Stops the thread pool. Does nothing if the pool is already stopped.
+ """
+ if self._done_event.is_set():
+ # Stop event set: we're stopped
+ return
+
+ # Set the stop event
+ self._done_event.set()
+
+ with self.__lock:
+ # Add something in the queue (to unlock the join())
+ try:
+ for _ in self._threads:
+ self._queue.put(self._done_event, True, self._timeout)
+ except queue.Full:
+ # There is already something in the queue
+ pass
+
+ # Copy the list of threads to wait for
+ threads = self._threads[:]
+
+ # Join threads outside the lock
+ for thread in threads:
+ while thread.is_alive():
+ # Wait 3 seconds
+ thread.join(3)
+ if thread.is_alive():
+ # Thread is still alive: something might be wrong
+ self._logger.warning("Thread %s is still alive...",
+ thread.name)
+
+ # Clear storage
+ del self._threads[:]
+ self.clear()
+
+ def enqueue(self, method, *args, **kwargs):
+ """
+ Queues a task in the pool
+
+ :param method: Method to call
+ :return: A FutureResult object, to get the result of the task
+ :raise ValueError: Invalid method
+ :raise Full: The task queue is full
+ """
+ if not hasattr(method, '__call__'):
+ raise ValueError("{0} has no __call__ member."
+ .format(method.__name__))
+
+ # Prepare the future result object
+ future = FutureResult(self._logger)
+
+ # Use a lock, as we might be "resetting" the queue
+ with self.__lock:
+ # Add the task to the queue
+ self._queue.put((method, args, kwargs, future), True,
+ self._timeout)
+
+ if self.__nb_active_threads == self.__nb_threads:
+ # All threads are taken: start a new one
+ self.__start_thread()
+
+ return future
+
+ def clear(self):
+ """
+ Empties the current queue content.
+ Returns once the queue have been emptied.
+ """
+ with self.__lock:
+ # Empty the current queue
+ try:
+ while True:
+ self._queue.get_nowait()
+ self._queue.task_done()
+ except queue.Empty:
+ # Queue is now empty
+ pass
+
+ # Wait for the tasks currently executed
+ self.join()
+
+ def join(self, timeout=None):
+ """
+ Waits for all the tasks to be executed
+
+ :param timeout: Maximum time to wait (in seconds)
+ :return: True if the queue has been emptied, else False
+ """
+ if self._queue.empty():
+ # Nothing to wait for...
+ return True
+ elif timeout is None:
+ # Use the original join
+ self._queue.join()
+ return True
+ else:
+ # Wait for the condition
+ with self._queue.all_tasks_done:
+ self._queue.all_tasks_done.wait(timeout)
+ return not bool(self._queue.unfinished_tasks)
+
+ def __run(self):
+ """
+ The main loop
+ """
+ with self.__lock:
+ self.__nb_threads += 1
+
+ while not self._done_event.is_set():
+ try:
+ # Wait for an action (blocking)
+ task = self._queue.get(True, self._timeout)
+ if task is self._done_event:
+ # Stop event in the queue: get out
+ self._queue.task_done()
+ with self.__lock:
+ self.__nb_threads -= 1
+ return
+ except queue.Empty:
+ # Nothing to do yet
+ pass
+ else:
+ with self.__lock:
+ self.__nb_active_threads += 1
+
+ # Extract elements
+ method, args, kwargs, future = task
+ try:
+ # Call the method
+ future.execute(method, args, kwargs)
+ except Exception as ex:
+ self._logger.exception("Error executing %s: %s",
+ method.__name__, ex)
+ finally:
+ # Mark the action as executed
+ self._queue.task_done()
+
+ # Thread is not active anymore
+ self.__nb_active_threads -= 1
+
+ # Clean up thread if necessary
+ with self.__lock:
+ if self.__nb_threads > self._min_threads:
+ # No more work for this thread, and we're above the
+ # minimum number of threads: stop this one
+ self.__nb_threads -= 1
+ return
+
+ with self.__lock:
+ # Thread stops
+ self.__nb_threads -= 1
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py
index 01b71fce..31183742 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib/utils.py
@@ -1,122 +1,122 @@
-#!/usr/bin/python
-# -- Content-Encoding: UTF-8 --
-"""
-Utility methods, for compatibility between Python version
-
-:author: Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-import sys
-
-# ------------------------------------------------------------------------------
-
-if sys.version_info[0] < 3:
- # Python 2
- import types
- try:
- string_types = (
- types.StringType,
- types.UnicodeType
- )
- except NameError:
- # Python built without unicode support
- string_types = (types.StringType,)
-
- numeric_types = (
- types.IntType,
- types.LongType,
- types.FloatType
- )
-
- def to_bytes(string):
- """
- Converts the given string into bytes
- """
- if type(string) is unicode:
- return str(string)
- return string
-
- def from_bytes(data):
- """
- Converts the given bytes into a string
- """
- if type(data) is str:
- return data
- return str(data)
-
-else:
- # Python 3
- string_types = (
- bytes,
- str
- )
-
- numeric_types = (
- int,
- float
- )
-
- def to_bytes(string):
- """
- Converts the given string into bytes
- """
- if type(string) is bytes:
- return string
- return bytes(string, "UTF-8")
-
- def from_bytes(data):
- """
- Converts the given bytes into a string
- """
- if type(data) is str:
- return data
- return str(data, "UTF-8")
-
-# ------------------------------------------------------------------------------
-# Common
-
-DictType = dict
-
-ListType = list
-TupleType = tuple
-
-iterable_types = (
- list,
- set, frozenset,
- tuple
-)
-
-value_types = (
- bool,
- type(None)
-)
-
-primitive_types = string_types + numeric_types + value_types
+#!/usr/bin/python
+# -- Content-Encoding: UTF-8 --
+"""
+Utility methods, for compatibility between Python version
+
+:author: Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+import sys
+
+# ------------------------------------------------------------------------------
+
+if sys.version_info[0] < 3:
+ # Python 2
+ import types
+ try:
+ string_types = (
+ types.StringType,
+ types.UnicodeType
+ )
+ except NameError:
+ # Python built without unicode support
+ string_types = (types.StringType,)
+
+ numeric_types = (
+ types.IntType,
+ types.LongType,
+ types.FloatType
+ )
+
+ def to_bytes(string):
+ """
+ Converts the given string into bytes
+ """
+ if type(string) is unicode:
+ return str(string)
+ return string
+
+ def from_bytes(data):
+ """
+ Converts the given bytes into a string
+ """
+ if type(data) is str:
+ return data
+ return str(data)
+
+else:
+ # Python 3
+ string_types = (
+ bytes,
+ str
+ )
+
+ numeric_types = (
+ int,
+ float
+ )
+
+ def to_bytes(string):
+ """
+ Converts the given string into bytes
+ """
+ if type(string) is bytes:
+ return string
+ return bytes(string, "UTF-8")
+
+ def from_bytes(data):
+ """
+ Converts the given bytes into a string
+ """
+ if type(data) is str:
+ return data
+ return str(data, "UTF-8")
+
+# ------------------------------------------------------------------------------
+# Common
+
+DictType = dict
+
+ListType = list
+TupleType = tuple
+
+iterable_types = (
+ list,
+ set, frozenset,
+ tuple
+)
+
+value_types = (
+ bool,
+ type(None)
+)
+
+primitive_types = string_types + numeric_types + value_types
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO
index 9d0f3fca..5dce6b1c 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/PKG-INFO
@@ -1,460 +1,460 @@
-Metadata-Version: 1.1
-Name: jsonrpclib-pelix
-Version: 0.2.5
-Summary: This project is an implementation of the JSON-RPC v2.0 specification (backwards-compatible) as a client library, for Python 2.6+ and Python 3.This version is a fork of jsonrpclib by Josh Marshall, usable with Pelix remote services.
-Home-page: http://github.com/tcalmant/jsonrpclib/
-Author: Thomas Calmant
-Author-email: thomas.calmant+github@gmail.com
-License: Apache License 2.0
-Description: JSONRPClib (patched for Pelix)
- ##############################
-
- .. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
- :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
-
- .. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
- :target: https://travis-ci.org/tcalmant/jsonrpclib
-
- .. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
- :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
-
-
- This library is an implementation of the JSON-RPC specification.
- It supports both the original 1.0 specification, as well as the
- new (proposed) 2.0 specification, which includes batch submission, keyword
- arguments, etc.
-
- It is licensed under the Apache License, Version 2.0
- (http://www.apache.org/licenses/LICENSE-2.0.html).
-
-
- About this version
- ******************
-
- This is a patched version of the original ``jsonrpclib`` project by
- Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
-
- The suffix *-pelix* only indicates that this version works with Pelix Remote
- Services, but it is **not** a Pelix specific implementation.
-
- * This version adds support for Python 3, staying compatible with Python 2.
- * It is now possible to use the dispatch_method argument while extending
- the SimpleJSONRPCDispatcher, to use a custom dispatcher.
- This allows to use this package by Pelix Remote Services.
- * It can use thread pools to control the number of threads spawned to handle
- notification requests and clients connections.
- * The modifications added in other forks of this project have been added:
-
- * From https://github.com/drdaeman/jsonrpclib:
-
- * Improved JSON-RPC 1.0 support
- * Less strict error response handling
-
- * From https://github.com/tuomassalo/jsonrpclib:
-
- * In case of a non-pre-defined error, raise an AppError and give access to
- *error.data*
-
- * From https://github.com/dejw/jsonrpclib:
-
- * Custom headers can be sent with request and associated tests
-
- * The support for Unix sockets has been removed, as it is not trivial to convert
- to Python 3 (and I don't use them)
- * This version cannot be installed with the original ``jsonrpclib``, as it uses
- the same package name.
-
-
- Summary
- *******
-
- This library implements the JSON-RPC 2.0 proposed specification in pure Python.
- It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
- (it extends where possible), so that projects using ``xmlrpclib`` could easily
- be modified to use JSON and experiment with the differences.
-
- It is backwards-compatible with the 1.0 specification, and supports all of the
- new proposed features of 2.0, including:
-
- * Batch submission (via MultiCall)
- * Keyword arguments
- * Notifications (both in a batch and 'normal')
- * Class translation using the ``__jsonclass__`` key.
-
- I've added a "SimpleJSONRPCServer", which is intended to emulate the
- "SimpleXMLRPCServer" from the default Python distribution.
-
-
- Requirements
- ************
-
- It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
- order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
- and then the ``simplejson`` external library).
- One of these must be installed to use this library, although if you have a
- standard distribution of 2.6+, you should already have one.
- Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
- you are going for full-on optimization you may want to pick it up.
-
- Since library uses ``contextlib`` module, you should have at least Python 2.5
- installed.
-
-
- Installation
- ************
-
- You can install this from PyPI with one of the following commands (sudo
- may be required):
-
- .. code-block:: console
-
- easy_install jsonrpclib-pelix
- pip install jsonrpclib-pelix
-
- Alternatively, you can download the source from the GitHub repository
- at http://github.com/tcalmant/jsonrpclib and manually install it
- with the following commands:
-
- .. code-block:: console
-
- git clone git://github.com/tcalmant/jsonrpclib.git
- cd jsonrpclib
- python setup.py install
-
-
- SimpleJSONRPCServer
- *******************
-
- This is identical in usage (or should be) to the SimpleXMLRPCServer in the
- Python standard library. Some of the differences in features are that it
- obviously supports notification, batch calls, class translation (if left on),
- etc.
- Note: The import line is slightly different from the regular SimpleXMLRPCServer,
- since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- server = SimpleJSONRPCServer(('localhost', 8080))
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
- server.serve_forever()
-
- To start protect the server with SSL, use the following snippet:
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- # Setup the SSL socket
- server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
- server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
- server_side=True)
- server.server_bind()
- server.server_activate()
-
- # ... register functions
- # Start the server
- server.serve_forever()
-
-
- Notification Thread Pool
- ========================
-
- By default, notification calls are handled in the request handling thread.
- It is possible to use a thread pool to handle them, by giving it to the server
- using the ``set_notification_pool()`` method:
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the thread pool: between 0 and 10 threads
- pool = ThreadPool(max_threads=10, min_threads=0)
-
- # Don't forget to start it
- pool.start()
-
- # Setup the server
- server = SimpleJSONRPCServer(('localhost', 8080), config)
- server.set_notification_pool(pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pool (let threads finish their current task)
- pool.stop()
- server.set_notification_pool(None)
-
-
- Threaded server
- ===============
-
- It is also possible to use a thread pool to handle clients requests, using the
- ``PooledJSONRPCServer`` class.
- By default, this class uses pool of 0 to 30 threads. A custom pool can be given
- with the ``thread_pool`` parameter of the class constructor.
-
- The notification pool and the request pool are different: by default, a server
- with a request pool doesn't have a notification pool.
-
- .. code-block:: python
-
- from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
- from jsonrpclib.threadpool import ThreadPool
-
- # Setup the notification and request pools
- nofif_pool = ThreadPool(max_threads=10, min_threads=0)
- request_pool = ThreadPool(max_threads=50, min_threads=10)
-
- # Don't forget to start them
- nofif_pool.start()
- request_pool.start()
-
- # Setup the server
- server = PooledJSONRPCServer(('localhost', 8080), config,
- thread_pool=request_pool)
- server.set_notification_pool(nofif_pool)
-
- # Register methods
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
-
- try:
- server.serve_forever()
- finally:
- # Stop the thread pools (let threads finish their current task)
- request_pool.stop()
- nofif_pool.stop()
- server.set_notification_pool(None)
-
- Client Usage
- ************
-
- This is (obviously) taken from a console session.
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
- >>> server.add(5,6)
- 11
- >>> server.add(x=5, y=10)
- 15
- >>> server._notify.add(5,6)
- # No result returned...
- >>> batch = jsonrpclib.MultiCall(server)
- >>> batch.add(5, 6)
- >>> batch.ping({'key':'value'})
- >>> batch._notify.add(4, 30)
- >>> results = batch()
- >>> for result in results:
- >>> ... print(result)
- 11
- {'key': 'value'}
- # Note that there are only two responses -- this is according to spec.
-
- # Clean up
- >>> server('close')()
-
- # Using client history
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
- >>> server.add(5,6)
- 11
- >>> print(history.request)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "method": "add", "params": [5, 6]}
- >>> print(history.response)
- {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
- "result": 11}
-
- # Clean up
- >>> server('close')()
-
- If you need 1.0 functionality, there are a bunch of places you can pass that in,
- although the best is just to give a specific configuration to
- ``jsonrpclib.ServerProxy``:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> jsonrpclib.config.DEFAULT.version
- 2.0
- >>> config = jsonrpclib.config.Config(version=1.0)
- >>> history = jsonrpclib.history.History()
- >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
- history=history)
- >>> server.add(7, 10)
- 17
- >>> print(history.request)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
- "method": "add", "params": [7, 10]}
- >>> print(history.response)
- {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
- >>> server('close')()
-
- The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
- modifications. The ``dumps`` arguments are almost identical, but it adds three
- arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
- compatibility, and ``notify`` if it's a request that you want to be a
- notification.
-
- Additionally, the ``loads`` method does not return the params and method like
- ``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
- b.) returns the entire structure of the request / response for manual parsing.
-
-
- Additional headers
- ******************
-
- If your remote service requires custom headers in request, you can pass them
- as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
- headers={'X-Test' : 'Test'})
-
- You can also put additional request headers only for certain method invocation:
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.Server("http://localhost:8080")
- >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
- ... test_server.ping(42)
- ...
- >>> # X-Test header will be no longer sent in requests
-
- Of course ``_additional_headers`` contexts can be nested as well.
-
-
- Class Translation
- *****************
-
- I've recently added "automatic" class translation support, although it is
- turned off by default. This can be devastatingly slow if improperly used, so
- the following is just a short list of things to keep in mind when using it.
-
- * Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
- * Do not require init params (for exceptions, keep reading)
- * Getter properties without setters could be dangerous (read: not tested)
-
- If any of the above are issues, use the _serialize method. (see usage below)
- The server and client must BOTH have use_jsonclass configuration item on and
- they must both have access to the same libraries used by the objects for
- this to work.
-
- If you have excessively nested arguments, it would be better to turn off the
- translation and manually invoke it on specific objects using
- ``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
- behavior recursively goes through attributes and lists / dicts / tuples).
-
- Sample file: *test_obj.py*
-
- .. code-block:: python
-
- # This object is /very/ simple, and the system will look through the
- # attributes and serialize what it can.
- class TestObj(object):
- foo = 'bar'
-
- # This object requires __init__ params, so it uses the _serialize method
- # and returns a tuple of init params and attribute values (the init params
- # can be a dict or a list, but the attribute values must be a dict.)
- class TestSerial(object):
- foo = 'bar'
- def __init__(self, *args):
- self.args = args
- def _serialize(self):
- return (self.args, {'foo':self.foo,})
-
- * Sample usage
-
- .. code-block:: python
-
- >>> import jsonrpclib
- >>> import test_obj
-
- # History is used only to print the serialized form of beans
- >>> history = jsonrpclib.history.History()
- >>> testobj1 = test_obj.TestObj()
- >>> testobj2 = test_obj.TestSerial()
- >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
-
- # The 'ping' just returns whatever is sent
- >>> ping1 = server.ping(testobj1)
- >>> ping2 = server.ping(testobj2)
-
- >>> print(history.request)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "method": "ping", "params": [{"__jsonclass__":
- ["test_obj.TestSerial", []], "foo": "bar"}
- ]}
- >>> print(history.response)
- {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
- "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
-
- This behavior is turned by default. To deactivate it, just set the
- ``use_jsonclass`` member of a server ``Config`` to False.
- If you want to use a per-class serialization method, set its name in the
- ``serialize_method`` member of a server ``Config``.
- Finally, if you are using classes that you have defined in the implementation
- (as in, not a separate library), you'll need to add those (on BOTH the server
- and the client) using the ``config.classes.add()`` method.
-
- Feedback on this "feature" is very, VERY much appreciated.
-
- Why JSON-RPC?
- *************
-
- In my opinion, there are several reasons to choose JSON over XML for RPC:
-
- * Much simpler to read (I suppose this is opinion, but I know I'm right. :)
- * Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
- * Parsing - JSON should be much quicker to parse than XML.
- * Easy class passing with ``jsonclass`` (when enabled)
-
- In the interest of being fair, there are also a few reasons to choose XML
- over JSON:
-
- * Your server doesn't do JSON (rather obvious)
- * Wider XML-RPC support across APIs (can we change this? :))
- * Libraries are more established, i.e. more stable (Let's change this too.)
-
- Tests
- *****
-
- Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
- They can be run using *unittest* or *nosetest*:
-
- .. code-block:: console
-
- python -m unittest discover tests
- python3 -m unittest discover tests
- nosetests tests
-
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: Apache Software License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.0
-Classifier: Programming Language :: Python :: 3.1
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
+Metadata-Version: 1.1
+Name: jsonrpclib-pelix
+Version: 0.2.5
+Summary: This project is an implementation of the JSON-RPC v2.0 specification (backwards-compatible) as a client library, for Python 2.6+ and Python 3.This version is a fork of jsonrpclib by Josh Marshall, usable with Pelix remote services.
+Home-page: http://github.com/tcalmant/jsonrpclib/
+Author: Thomas Calmant
+Author-email: thomas.calmant+github@gmail.com
+License: Apache License 2.0
+Description: JSONRPClib (patched for Pelix)
+ ##############################
+
+ .. image:: https://pypip.in/license/jsonrpclib-pelix/badge.svg
+ :target: https://pypi.python.org/pypi/jsonrpclib-pelix/
+
+ .. image:: https://travis-ci.org/tcalmant/jsonrpclib.svg?branch=master
+ :target: https://travis-ci.org/tcalmant/jsonrpclib
+
+ .. image:: https://coveralls.io/repos/tcalmant/jsonrpclib/badge.svg?branch=master
+ :target: https://coveralls.io/r/tcalmant/jsonrpclib?branch=master
+
+
+ This library is an implementation of the JSON-RPC specification.
+ It supports both the original 1.0 specification, as well as the
+ new (proposed) 2.0 specification, which includes batch submission, keyword
+ arguments, etc.
+
+ It is licensed under the Apache License, Version 2.0
+ (http://www.apache.org/licenses/LICENSE-2.0.html).
+
+
+ About this version
+ ******************
+
+ This is a patched version of the original ``jsonrpclib`` project by
+ Josh Marshall, available at https://github.com/joshmarshall/jsonrpclib.
+
+ The suffix *-pelix* only indicates that this version works with Pelix Remote
+ Services, but it is **not** a Pelix specific implementation.
+
+ * This version adds support for Python 3, staying compatible with Python 2.
+ * It is now possible to use the dispatch_method argument while extending
+ the SimpleJSONRPCDispatcher, to use a custom dispatcher.
+ This allows to use this package by Pelix Remote Services.
+ * It can use thread pools to control the number of threads spawned to handle
+ notification requests and clients connections.
+ * The modifications added in other forks of this project have been added:
+
+ * From https://github.com/drdaeman/jsonrpclib:
+
+ * Improved JSON-RPC 1.0 support
+ * Less strict error response handling
+
+ * From https://github.com/tuomassalo/jsonrpclib:
+
+ * In case of a non-pre-defined error, raise an AppError and give access to
+ *error.data*
+
+ * From https://github.com/dejw/jsonrpclib:
+
+ * Custom headers can be sent with request and associated tests
+
+ * The support for Unix sockets has been removed, as it is not trivial to convert
+ to Python 3 (and I don't use them)
+ * This version cannot be installed with the original ``jsonrpclib``, as it uses
+ the same package name.
+
+
+ Summary
+ *******
+
+ This library implements the JSON-RPC 2.0 proposed specification in pure Python.
+ It is designed to be as compatible with the syntax of ``xmlrpclib`` as possible
+ (it extends where possible), so that projects using ``xmlrpclib`` could easily
+ be modified to use JSON and experiment with the differences.
+
+ It is backwards-compatible with the 1.0 specification, and supports all of the
+ new proposed features of 2.0, including:
+
+ * Batch submission (via MultiCall)
+ * Keyword arguments
+ * Notifications (both in a batch and 'normal')
+ * Class translation using the ``__jsonclass__`` key.
+
+ I've added a "SimpleJSONRPCServer", which is intended to emulate the
+ "SimpleXMLRPCServer" from the default Python distribution.
+
+
+ Requirements
+ ************
+
+ It supports ``cjson`` and ``simplejson``, and looks for the parsers in that
+ order (searching first for ``cjson``, then for the *built-in* ``json`` in 2.6+,
+ and then the ``simplejson`` external library).
+ One of these must be installed to use this library, although if you have a
+ standard distribution of 2.6+, you should already have one.
+ Keep in mind that ``cjson`` is supposed to be the quickest, I believe, so if
+ you are going for full-on optimization you may want to pick it up.
+
+ Since library uses ``contextlib`` module, you should have at least Python 2.5
+ installed.
+
+
+ Installation
+ ************
+
+ You can install this from PyPI with one of the following commands (sudo
+ may be required):
+
+ .. code-block:: console
+
+ easy_install jsonrpclib-pelix
+ pip install jsonrpclib-pelix
+
+ Alternatively, you can download the source from the GitHub repository
+ at http://github.com/tcalmant/jsonrpclib and manually install it
+ with the following commands:
+
+ .. code-block:: console
+
+ git clone git://github.com/tcalmant/jsonrpclib.git
+ cd jsonrpclib
+ python setup.py install
+
+
+ SimpleJSONRPCServer
+ *******************
+
+ This is identical in usage (or should be) to the SimpleXMLRPCServer in the
+ Python standard library. Some of the differences in features are that it
+ obviously supports notification, batch calls, class translation (if left on),
+ etc.
+ Note: The import line is slightly different from the regular SimpleXMLRPCServer,
+ since the SimpleJSONRPCServer is distributed within the ``jsonrpclib`` library.
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ server = SimpleJSONRPCServer(('localhost', 8080))
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+ server.serve_forever()
+
+ To start protect the server with SSL, use the following snippet:
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+
+ # Setup the SSL socket
+ server = SimpleJSONRPCServer(('localhost', 8080), bind_and_activate=False)
+ server.socket = ssl.wrap_socket(server.socket, certfile='server.pem',
+ server_side=True)
+ server.server_bind()
+ server.server_activate()
+
+ # ... register functions
+ # Start the server
+ server.serve_forever()
+
+
+ Notification Thread Pool
+ ========================
+
+ By default, notification calls are handled in the request handling thread.
+ It is possible to use a thread pool to handle them, by giving it to the server
+ using the ``set_notification_pool()`` method:
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the thread pool: between 0 and 10 threads
+ pool = ThreadPool(max_threads=10, min_threads=0)
+
+ # Don't forget to start it
+ pool.start()
+
+ # Setup the server
+ server = SimpleJSONRPCServer(('localhost', 8080), config)
+ server.set_notification_pool(pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pool (let threads finish their current task)
+ pool.stop()
+ server.set_notification_pool(None)
+
+
+ Threaded server
+ ===============
+
+ It is also possible to use a thread pool to handle clients requests, using the
+ ``PooledJSONRPCServer`` class.
+ By default, this class uses pool of 0 to 30 threads. A custom pool can be given
+ with the ``thread_pool`` parameter of the class constructor.
+
+ The notification pool and the request pool are different: by default, a server
+ with a request pool doesn't have a notification pool.
+
+ .. code-block:: python
+
+ from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
+ from jsonrpclib.threadpool import ThreadPool
+
+ # Setup the notification and request pools
+ nofif_pool = ThreadPool(max_threads=10, min_threads=0)
+ request_pool = ThreadPool(max_threads=50, min_threads=10)
+
+ # Don't forget to start them
+ nofif_pool.start()
+ request_pool.start()
+
+ # Setup the server
+ server = PooledJSONRPCServer(('localhost', 8080), config,
+ thread_pool=request_pool)
+ server.set_notification_pool(nofif_pool)
+
+ # Register methods
+ server.register_function(pow)
+ server.register_function(lambda x,y: x+y, 'add')
+ server.register_function(lambda x: x, 'ping')
+
+ try:
+ server.serve_forever()
+ finally:
+ # Stop the thread pools (let threads finish their current task)
+ request_pool.stop()
+ nofif_pool.stop()
+ server.set_notification_pool(None)
+
+ Client Usage
+ ************
+
+ This is (obviously) taken from a console session.
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080')
+ >>> server.add(5,6)
+ 11
+ >>> server.add(x=5, y=10)
+ 15
+ >>> server._notify.add(5,6)
+ # No result returned...
+ >>> batch = jsonrpclib.MultiCall(server)
+ >>> batch.add(5, 6)
+ >>> batch.ping({'key':'value'})
+ >>> batch._notify.add(4, 30)
+ >>> results = batch()
+ >>> for result in results:
+ >>> ... print(result)
+ 11
+ {'key': 'value'}
+ # Note that there are only two responses -- this is according to spec.
+
+ # Clean up
+ >>> server('close')()
+
+ # Using client history
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', history=history)
+ >>> server.add(5,6)
+ 11
+ >>> print(history.request)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "method": "add", "params": [5, 6]}
+ >>> print(history.response)
+ {"id": "f682b956-c8e1-4506-9db4-29fe8bc9fcaa", "jsonrpc": "2.0",
+ "result": 11}
+
+ # Clean up
+ >>> server('close')()
+
+ If you need 1.0 functionality, there are a bunch of places you can pass that in,
+ although the best is just to give a specific configuration to
+ ``jsonrpclib.ServerProxy``:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> jsonrpclib.config.DEFAULT.version
+ 2.0
+ >>> config = jsonrpclib.config.Config(version=1.0)
+ >>> history = jsonrpclib.history.History()
+ >>> server = jsonrpclib.ServerProxy('http://localhost:8080', config=config,
+ history=history)
+ >>> server.add(7, 10)
+ 17
+ >>> print(history.request)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32",
+ "method": "add", "params": [7, 10]}
+ >>> print(history.response)
+ {"id": "827b2923-5b37-49a5-8b36-e73920a16d32", "error": null, "result": 17}
+ >>> server('close')()
+
+ The equivalent ``loads`` and ``dumps`` functions also exist, although with minor
+ modifications. The ``dumps`` arguments are almost identical, but it adds three
+ arguments: ``rpcid`` for the 'id' key, ``version`` to specify the JSON-RPC
+ compatibility, and ``notify`` if it's a request that you want to be a
+ notification.
+
+ Additionally, the ``loads`` method does not return the params and method like
+ ``xmlrpclib``, but instead a.) parses for errors, raising ProtocolErrors, and
+ b.) returns the entire structure of the request / response for manual parsing.
+
+
+ Additional headers
+ ******************
+
+ If your remote service requires custom headers in request, you can pass them
+ as as a ``headers`` keyword argument, when creating the ``ServerProxy``:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.ServerProxy("http://localhost:8080",
+ headers={'X-Test' : 'Test'})
+
+ You can also put additional request headers only for certain method invocation:
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> server = jsonrpclib.Server("http://localhost:8080")
+ >>> with server._additional_headers({'X-Test' : 'Test'}) as test_server:
+ ... test_server.ping(42)
+ ...
+ >>> # X-Test header will be no longer sent in requests
+
+ Of course ``_additional_headers`` contexts can be nested as well.
+
+
+ Class Translation
+ *****************
+
+ I've recently added "automatic" class translation support, although it is
+ turned off by default. This can be devastatingly slow if improperly used, so
+ the following is just a short list of things to keep in mind when using it.
+
+ * Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
+ * Do not require init params (for exceptions, keep reading)
+ * Getter properties without setters could be dangerous (read: not tested)
+
+ If any of the above are issues, use the _serialize method. (see usage below)
+ The server and client must BOTH have use_jsonclass configuration item on and
+ they must both have access to the same libraries used by the objects for
+ this to work.
+
+ If you have excessively nested arguments, it would be better to turn off the
+ translation and manually invoke it on specific objects using
+ ``jsonrpclib.jsonclass.dump`` / ``jsonrpclib.jsonclass.load`` (since the default
+ behavior recursively goes through attributes and lists / dicts / tuples).
+
+ Sample file: *test_obj.py*
+
+ .. code-block:: python
+
+ # This object is /very/ simple, and the system will look through the
+ # attributes and serialize what it can.
+ class TestObj(object):
+ foo = 'bar'
+
+ # This object requires __init__ params, so it uses the _serialize method
+ # and returns a tuple of init params and attribute values (the init params
+ # can be a dict or a list, but the attribute values must be a dict.)
+ class TestSerial(object):
+ foo = 'bar'
+ def __init__(self, *args):
+ self.args = args
+ def _serialize(self):
+ return (self.args, {'foo':self.foo,})
+
+ * Sample usage
+
+ .. code-block:: python
+
+ >>> import jsonrpclib
+ >>> import test_obj
+
+ # History is used only to print the serialized form of beans
+ >>> history = jsonrpclib.history.History()
+ >>> testobj1 = test_obj.TestObj()
+ >>> testobj2 = test_obj.TestSerial()
+ >>> server = jsonrpclib.Server('http://localhost:8080', history=history)
+
+ # The 'ping' just returns whatever is sent
+ >>> ping1 = server.ping(testobj1)
+ >>> ping2 = server.ping(testobj2)
+
+ >>> print(history.request)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "method": "ping", "params": [{"__jsonclass__":
+ ["test_obj.TestSerial", []], "foo": "bar"}
+ ]}
+ >>> print(history.response)
+ {"id": "7805f1f9-9abd-49c6-81dc-dbd47229fe13", "jsonrpc": "2.0",
+ "result": {"__jsonclass__": ["test_obj.TestSerial", []], "foo": "bar"}}
+
+ This behavior is turned by default. To deactivate it, just set the
+ ``use_jsonclass`` member of a server ``Config`` to False.
+ If you want to use a per-class serialization method, set its name in the
+ ``serialize_method`` member of a server ``Config``.
+ Finally, if you are using classes that you have defined in the implementation
+ (as in, not a separate library), you'll need to add those (on BOTH the server
+ and the client) using the ``config.classes.add()`` method.
+
+ Feedback on this "feature" is very, VERY much appreciated.
+
+ Why JSON-RPC?
+ *************
+
+ In my opinion, there are several reasons to choose JSON over XML for RPC:
+
+ * Much simpler to read (I suppose this is opinion, but I know I'm right. :)
+ * Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
+ * Parsing - JSON should be much quicker to parse than XML.
+ * Easy class passing with ``jsonclass`` (when enabled)
+
+ In the interest of being fair, there are also a few reasons to choose XML
+ over JSON:
+
+ * Your server doesn't do JSON (rather obvious)
+ * Wider XML-RPC support across APIs (can we change this? :))
+ * Libraries are more established, i.e. more stable (Let's change this too.)
+
+ Tests
+ *****
+
+ Tests are an almost-verbatim drop from the JSON-RPC specification 2.0 page.
+ They can be run using *unittest* or *nosetest*:
+
+ .. code-block:: console
+
+ python -m unittest discover tests
+ python3 -m unittest discover tests
+ nosetests tests
+
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.0
+Classifier: Programming Language :: Python :: 3.1
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt
index f5714032..f5714032 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/SOURCES.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt
index 8b137891..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/dependency_links.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt
index 1410b2ff..1410b2ff 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/jsonrpclib_pelix.egg-info/top_level.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.cfg b/external_libs/python/jsonrpclib-pelix-0.2.5/setup.cfg
index 26c67942..7633f817 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.cfg
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/setup.cfg
@@ -1,8 +1,8 @@
-[bdist_wheel]
-universal = 1
-
-[egg_info]
-tag_date = 0
-tag_svn_revision = 0
-tag_build =
-
+[bdist_wheel]
+universal = 1
+
+[egg_info]
+tag_date = 0
+tag_svn_revision = 0
+tag_build =
+
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.py b/external_libs/python/jsonrpclib-pelix-0.2.5/setup.py
index a64f2fb0..fb28d630 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/setup.py
+++ b/external_libs/python/jsonrpclib-pelix-0.2.5/setup.py
@@ -1,74 +1,74 @@
-#!/usr/bin/env python
-# -- Content-Encoding: UTF-8 --
-"""
-Installation script
-
-:authors: Josh Marshall, Thomas Calmant
-:copyright: Copyright 2015, isandlaTech
-:license: Apache License 2.0
-:version: 0.2.5
-
-..
-
- Copyright 2015 isandlaTech
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-# Module version
-__version_info__ = (0, 2, 5)
-__version__ = ".".join(str(x) for x in __version_info__)
-
-# Documentation strings format
-__docformat__ = "restructuredtext en"
-
-# ------------------------------------------------------------------------------
-
-import sys
-
-try:
- from setuptools import setup
-except ImportError:
- from distutils.core import setup
-
-# ------------------------------------------------------------------------------
-
-setup(
- name="jsonrpclib-pelix",
- version=__version__,
- license="Apache License 2.0",
- author="Thomas Calmant",
- author_email="thomas.calmant+github@gmail.com",
- url="http://github.com/tcalmant/jsonrpclib/",
- description=
- "This project is an implementation of the JSON-RPC v2.0 specification "
- "(backwards-compatible) as a client library, for Python 2.6+ and Python 3."
- "This version is a fork of jsonrpclib by Josh Marshall, "
- "usable with Pelix remote services.",
- long_description=open("README.rst").read(),
- packages=["jsonrpclib"],
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Apache Software License',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.0',
- 'Programming Language :: Python :: 3.1',
- 'Programming Language :: Python :: 3.2',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4'],
- tests_require=['unittest2'] if sys.version_info < (2, 7) else []
-)
+#!/usr/bin/env python
+# -- Content-Encoding: UTF-8 --
+"""
+Installation script
+
+:authors: Josh Marshall, Thomas Calmant
+:copyright: Copyright 2015, isandlaTech
+:license: Apache License 2.0
+:version: 0.2.5
+
+..
+
+ Copyright 2015 isandlaTech
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+# Module version
+__version_info__ = (0, 2, 5)
+__version__ = ".".join(str(x) for x in __version_info__)
+
+# Documentation strings format
+__docformat__ = "restructuredtext en"
+
+# ------------------------------------------------------------------------------
+
+import sys
+
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+# ------------------------------------------------------------------------------
+
+setup(
+ name="jsonrpclib-pelix",
+ version=__version__,
+ license="Apache License 2.0",
+ author="Thomas Calmant",
+ author_email="thomas.calmant+github@gmail.com",
+ url="http://github.com/tcalmant/jsonrpclib/",
+ description=
+ "This project is an implementation of the JSON-RPC v2.0 specification "
+ "(backwards-compatible) as a client library, for Python 2.6+ and Python 3."
+ "This version is a fork of jsonrpclib by Josh Marshall, "
+ "usable with Pelix remote services.",
+ long_description=open("README.rst").read(),
+ packages=["jsonrpclib"],
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.0',
+ 'Programming Language :: Python :: 3.1',
+ 'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4'],
+ tests_require=['unittest2'] if sys.version_info < (2, 7) else []
+)
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ACKS b/external_libs/python/lockfile-0.10.2/ACKS
index 44519d17..44519d17 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ACKS
+++ b/external_libs/python/lockfile-0.10.2/ACKS
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/AUTHORS b/external_libs/python/lockfile-0.10.2/AUTHORS
index fda721cd..fda721cd 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/AUTHORS
+++ b/external_libs/python/lockfile-0.10.2/AUTHORS
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ChangeLog b/external_libs/python/lockfile-0.10.2/ChangeLog
index 3ba36a7d..3ba36a7d 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/ChangeLog
+++ b/external_libs/python/lockfile-0.10.2/ChangeLog
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/LICENSE b/external_libs/python/lockfile-0.10.2/LICENSE
index 610c0793..610c0793 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/LICENSE
+++ b/external_libs/python/lockfile-0.10.2/LICENSE
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/PKG-INFO b/external_libs/python/lockfile-0.10.2/PKG-INFO
index 9f72376f..9f72376f 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/PKG-INFO
+++ b/external_libs/python/lockfile-0.10.2/PKG-INFO
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/README b/external_libs/python/lockfile-0.10.2/README
index 5f7acbc4..5f7acbc4 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/README
+++ b/external_libs/python/lockfile-0.10.2/README
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/RELEASE-NOTES b/external_libs/python/lockfile-0.10.2/RELEASE-NOTES
index 8b452ed1..8b452ed1 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/RELEASE-NOTES
+++ b/external_libs/python/lockfile-0.10.2/RELEASE-NOTES
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/Makefile b/external_libs/python/lockfile-0.10.2/doc/source/Makefile
index 1b1e8d28..1b1e8d28 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/Makefile
+++ b/external_libs/python/lockfile-0.10.2/doc/source/Makefile
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/conf.py b/external_libs/python/lockfile-0.10.2/doc/source/conf.py
index 623edcb5..623edcb5 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/conf.py
+++ b/external_libs/python/lockfile-0.10.2/doc/source/conf.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/index.rst b/external_libs/python/lockfile-0.10.2/doc/source/index.rst
index f76173dc..f76173dc 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/doc/source/index.rst
+++ b/external_libs/python/lockfile-0.10.2/doc/source/index.rst
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/PKG-INFO b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/PKG-INFO
index 9f72376f..9f72376f 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/PKG-INFO
+++ b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/PKG-INFO
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt
index 4b289f3a..4b289f3a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt
+++ b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/SOURCES.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt
index 8b137891..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt
+++ b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/dependency_links.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/not-zip-safe b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/not-zip-safe
index 8b137891..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/not-zip-safe
+++ b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/not-zip-safe
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/top_level.txt b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/top_level.txt
index 5a13159a..5a13159a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile.egg-info/top_level.txt
+++ b/external_libs/python/lockfile-0.10.2/lockfile.egg-info/top_level.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/__init__.py b/external_libs/python/lockfile-0.10.2/lockfile/__init__.py
index d905af96..d905af96 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/__init__.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/linklockfile.py b/external_libs/python/lockfile-0.10.2/lockfile/linklockfile.py
index 9c506734..9c506734 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/linklockfile.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/linklockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/mkdirlockfile.py b/external_libs/python/lockfile-0.10.2/lockfile/mkdirlockfile.py
index 8d2c801f..8d2c801f 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/mkdirlockfile.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/mkdirlockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/pidlockfile.py b/external_libs/python/lockfile-0.10.2/lockfile/pidlockfile.py
index e92f9ead..e92f9ead 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/pidlockfile.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/pidlockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/sqlitelockfile.py b/external_libs/python/lockfile-0.10.2/lockfile/sqlitelockfile.py
index 7dee4a85..7dee4a85 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/sqlitelockfile.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/sqlitelockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/symlinklockfile.py b/external_libs/python/lockfile-0.10.2/lockfile/symlinklockfile.py
index 57551a36..57551a36 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/lockfile/symlinklockfile.py
+++ b/external_libs/python/lockfile-0.10.2/lockfile/symlinklockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.cfg b/external_libs/python/lockfile-0.10.2/setup.cfg
index c1fb3984..c1fb3984 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.cfg
+++ b/external_libs/python/lockfile-0.10.2/setup.cfg
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.py b/external_libs/python/lockfile-0.10.2/setup.py
index 73637574..73637574 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/setup.py
+++ b/external_libs/python/lockfile-0.10.2/setup.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test-requirements.txt b/external_libs/python/lockfile-0.10.2/test-requirements.txt
index 2e087ff1..2e087ff1 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test-requirements.txt
+++ b/external_libs/python/lockfile-0.10.2/test-requirements.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/compliancetest.py b/external_libs/python/lockfile-0.10.2/test/compliancetest.py
index e0258b11..e0258b11 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/compliancetest.py
+++ b/external_libs/python/lockfile-0.10.2/test/compliancetest.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/test_lockfile.py b/external_libs/python/lockfile-0.10.2/test/test_lockfile.py
index e1f4f72f..e1f4f72f 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/test/test_lockfile.py
+++ b/external_libs/python/lockfile-0.10.2/test/test_lockfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/tox.ini b/external_libs/python/lockfile-0.10.2/tox.ini
index b0a868a3..b0a868a3 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/lockfile-0.10.2/tox.ini
+++ b/external_libs/python/lockfile-0.10.2/tox.ini
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/ChangeLog b/external_libs/python/python-daemon-2.0.5/ChangeLog
index 4975f781..4975f781 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/ChangeLog
+++ b/external_libs/python/python-daemon-2.0.5/ChangeLog
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.ASF-2 b/external_libs/python/python-daemon-2.0.5/LICENSE.ASF-2
index d6456956..d6456956 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.ASF-2
+++ b/external_libs/python/python-daemon-2.0.5/LICENSE.ASF-2
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.GPL-3 b/external_libs/python/python-daemon-2.0.5/LICENSE.GPL-3
index 94a9ed02..94a9ed02 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/LICENSE.GPL-3
+++ b/external_libs/python/python-daemon-2.0.5/LICENSE.GPL-3
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/MANIFEST.in b/external_libs/python/python-daemon-2.0.5/MANIFEST.in
index d3d4341e..d3d4341e 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/MANIFEST.in
+++ b/external_libs/python/python-daemon-2.0.5/MANIFEST.in
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/PKG-INFO b/external_libs/python/python-daemon-2.0.5/PKG-INFO
index fd81f509..fd81f509 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/PKG-INFO
+++ b/external_libs/python/python-daemon-2.0.5/PKG-INFO
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/__init__.py b/external_libs/python/python-daemon-2.0.5/daemon/__init__.py
index 4731a6ef..4731a6ef 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/__init__.py
+++ b/external_libs/python/python-daemon-2.0.5/daemon/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/_metadata.py b/external_libs/python/python-daemon-2.0.5/daemon/_metadata.py
index 6d22a2b7..6d22a2b7 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/_metadata.py
+++ b/external_libs/python/python-daemon-2.0.5/daemon/_metadata.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/daemon.py b/external_libs/python/python-daemon-2.0.5/daemon/daemon.py
index 07810cf1..07810cf1 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/daemon.py
+++ b/external_libs/python/python-daemon-2.0.5/daemon/daemon.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/pidfile.py b/external_libs/python/python-daemon-2.0.5/daemon/pidfile.py
index 4517ee0e..4517ee0e 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/pidfile.py
+++ b/external_libs/python/python-daemon-2.0.5/daemon/pidfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/runner.py b/external_libs/python/python-daemon-2.0.5/daemon/runner.py
index 6973cf1c..6973cf1c 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/daemon/runner.py
+++ b/external_libs/python/python-daemon-2.0.5/daemon/runner.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/CREDITS b/external_libs/python/python-daemon-2.0.5/doc/CREDITS
index feb65d5e..feb65d5e 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/CREDITS
+++ b/external_libs/python/python-daemon-2.0.5/doc/CREDITS
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/FAQ b/external_libs/python/python-daemon-2.0.5/doc/FAQ
index 1fcc4658..1fcc4658 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/FAQ
+++ b/external_libs/python/python-daemon-2.0.5/doc/FAQ
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/TODO b/external_libs/python/python-daemon-2.0.5/doc/TODO
index 81b41481..81b41481 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/TODO
+++ b/external_libs/python/python-daemon-2.0.5/doc/TODO
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/hacking.txt b/external_libs/python/python-daemon-2.0.5/doc/hacking.txt
index 9484dbd0..9484dbd0 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/doc/hacking.txt
+++ b/external_libs/python/python-daemon-2.0.5/doc/hacking.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO
index fd81f509..fd81f509 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/PKG-INFO
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt
index 6e176719..6e176719 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/SOURCES.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt
index 8b137891..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/dependency_links.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/__init__.py b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe
index d3f5a12f..8b137891 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/__init__.py
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/not-zip-safe
@@ -1 +1 @@
-
+
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/requires.txt b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/requires.txt
index d1496b02..d1496b02 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/requires.txt
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/requires.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt
index 28e3ee0c..28e3ee0c 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/top_level.txt
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/version_info.json b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/version_info.json
index bac1b84f..bac1b84f 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/python_daemon.egg-info/version_info.json
+++ b/external_libs/python/python-daemon-2.0.5/python_daemon.egg-info/version_info.json
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.cfg b/external_libs/python/python-daemon-2.0.5/setup.cfg
index 9d3d2c02..9d3d2c02 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.cfg
+++ b/external_libs/python/python-daemon-2.0.5/setup.cfg
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.py b/external_libs/python/python-daemon-2.0.5/setup.py
index 16a6a6a6..16a6a6a6 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/setup.py
+++ b/external_libs/python/python-daemon-2.0.5/setup.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/__init__.py b/external_libs/python/python-daemon-2.0.5/test/__init__.py
index 398519f1..398519f1 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/__init__.py
+++ b/external_libs/python/python-daemon-2.0.5/test/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/scaffold.py b/external_libs/python/python-daemon-2.0.5/test/scaffold.py
index 9a4f1150..9a4f1150 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/scaffold.py
+++ b/external_libs/python/python-daemon-2.0.5/test/scaffold.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_daemon.py b/external_libs/python/python-daemon-2.0.5/test/test_daemon.py
index a911858a..a911858a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_daemon.py
+++ b/external_libs/python/python-daemon-2.0.5/test/test_daemon.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_metadata.py b/external_libs/python/python-daemon-2.0.5/test/test_metadata.py
index 692753f4..692753f4 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_metadata.py
+++ b/external_libs/python/python-daemon-2.0.5/test/test_metadata.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_pidfile.py b/external_libs/python/python-daemon-2.0.5/test/test_pidfile.py
index 9b636ec8..9b636ec8 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_pidfile.py
+++ b/external_libs/python/python-daemon-2.0.5/test/test_pidfile.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_runner.py b/external_libs/python/python-daemon-2.0.5/test/test_runner.py
index 4c0c714a..4c0c714a 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test/test_runner.py
+++ b/external_libs/python/python-daemon-2.0.5/test/test_runner.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test_version.py b/external_libs/python/python-daemon-2.0.5/test_version.py
index b52f521d..b52f521d 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/test_version.py
+++ b/external_libs/python/python-daemon-2.0.5/test_version.py
diff --git a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/version.py b/external_libs/python/python-daemon-2.0.5/version.py
index 7e4c4202..7e4c4202 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/python-daemon-2.0.5/version.py
+++ b/external_libs/python/python-daemon-2.0.5/version.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in b/external_libs/python/termstyle/MANIFEST.in
index 14dafaf3..14dafaf3 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/MANIFEST.in
+++ b/external_libs/python/termstyle/MANIFEST.in
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/Makefile b/external_libs/python/termstyle/Makefile
index 02151dca..02151dca 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/Makefile
+++ b/external_libs/python/termstyle/Makefile
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/README.rst b/external_libs/python/termstyle/README.rst
index f3dfa0ab..f3dfa0ab 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/README.rst
+++ b/external_libs/python/termstyle/README.rst
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/VERSION b/external_libs/python/termstyle/VERSION
index 345f8cc0..345f8cc0 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/VERSION
+++ b/external_libs/python/termstyle/VERSION
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py b/external_libs/python/termstyle/__init__.py
index e69de29b..e69de29b 100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/__init__.py
+++ b/external_libs/python/termstyle/__init__.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml b/external_libs/python/termstyle/python-termstyle.xml
index b6b08bd7..b6b08bd7 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/python-termstyle.xml
+++ b/external_libs/python/termstyle/python-termstyle.xml
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/setup.py b/external_libs/python/termstyle/setup.py
index 69b11cbb..69b11cbb 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/setup.py
+++ b/external_libs/python/termstyle/setup.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py b/external_libs/python/termstyle/termstyle.py
index 62a3a920..62a3a920 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/termstyle.py
+++ b/external_libs/python/termstyle/termstyle.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test2.py b/external_libs/python/termstyle/test2.py
index 2d84c375..2d84c375 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/test2.py
+++ b/external_libs/python/termstyle/test2.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test3.py b/external_libs/python/termstyle/test3.py
index 861c44f9..861c44f9 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/test3.py
+++ b/external_libs/python/termstyle/test3.py
diff --git a/scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh b/external_libs/python/termstyle/test_all.sh
index d28545a9..d28545a9 100755..100644
--- a/scripts/automation/trex_control_plane/python_lib/termstyle/test_all.sh
+++ b/external_libs/python/termstyle/test_all.sh
diff --git a/src/console/zmq/__init__.py b/external_libs/python/zmq/__init__.py
index 3408b3ba..3408b3ba 100755..100644
--- a/src/console/zmq/__init__.py
+++ b/external_libs/python/zmq/__init__.py
diff --git a/src/console/zmq/auth/__init__.py b/external_libs/python/zmq/auth/__init__.py
index 11d3ad6b..11d3ad6b 100755..100644
--- a/src/console/zmq/auth/__init__.py
+++ b/external_libs/python/zmq/auth/__init__.py
diff --git a/src/console/zmq/auth/base.py b/external_libs/python/zmq/auth/base.py
index 9b4aaed7..9b4aaed7 100755..100644
--- a/src/console/zmq/auth/base.py
+++ b/external_libs/python/zmq/auth/base.py
diff --git a/src/console/zmq/auth/certs.py b/external_libs/python/zmq/auth/certs.py
index 4d26ad7b..4d26ad7b 100755..100644
--- a/src/console/zmq/auth/certs.py
+++ b/external_libs/python/zmq/auth/certs.py
diff --git a/src/console/zmq/auth/ioloop.py b/external_libs/python/zmq/auth/ioloop.py
index 1f448b47..1f448b47 100755..100644
--- a/src/console/zmq/auth/ioloop.py
+++ b/external_libs/python/zmq/auth/ioloop.py
diff --git a/src/console/zmq/auth/thread.py b/external_libs/python/zmq/auth/thread.py
index 8c3355a9..8c3355a9 100755..100644
--- a/src/console/zmq/auth/thread.py
+++ b/external_libs/python/zmq/auth/thread.py
diff --git a/src/console/zmq/backend/__init__.py b/external_libs/python/zmq/backend/__init__.py
index 7cac725c..7cac725c 100755..100644
--- a/src/console/zmq/backend/__init__.py
+++ b/external_libs/python/zmq/backend/__init__.py
diff --git a/src/console/zmq/backend/cffi/__init__.py b/external_libs/python/zmq/backend/cffi/__init__.py
index ca3164d3..ca3164d3 100755..100644
--- a/src/console/zmq/backend/cffi/__init__.py
+++ b/external_libs/python/zmq/backend/cffi/__init__.py
diff --git a/src/console/zmq/backend/cffi/_cdefs.h b/external_libs/python/zmq/backend/cffi/_cdefs.h
index d3300575..d3300575 100644
--- a/src/console/zmq/backend/cffi/_cdefs.h
+++ b/external_libs/python/zmq/backend/cffi/_cdefs.h
diff --git a/src/console/zmq/backend/cffi/_cffi.py b/external_libs/python/zmq/backend/cffi/_cffi.py
index c73ebf83..c73ebf83 100755..100644
--- a/src/console/zmq/backend/cffi/_cffi.py
+++ b/external_libs/python/zmq/backend/cffi/_cffi.py
diff --git a/src/console/zmq/backend/cffi/_poll.py b/external_libs/python/zmq/backend/cffi/_poll.py
index 9bca34ca..9bca34ca 100755..100644
--- a/src/console/zmq/backend/cffi/_poll.py
+++ b/external_libs/python/zmq/backend/cffi/_poll.py
diff --git a/src/console/zmq/backend/cffi/_verify.c b/external_libs/python/zmq/backend/cffi/_verify.c
index 547840eb..547840eb 100644
--- a/src/console/zmq/backend/cffi/_verify.c
+++ b/external_libs/python/zmq/backend/cffi/_verify.c
diff --git a/src/console/zmq/backend/cffi/constants.py b/external_libs/python/zmq/backend/cffi/constants.py
index ee293e74..ee293e74 100755..100644
--- a/src/console/zmq/backend/cffi/constants.py
+++ b/external_libs/python/zmq/backend/cffi/constants.py
diff --git a/src/console/zmq/backend/cffi/context.py b/external_libs/python/zmq/backend/cffi/context.py
index 16a7b257..16a7b257 100755..100644
--- a/src/console/zmq/backend/cffi/context.py
+++ b/external_libs/python/zmq/backend/cffi/context.py
diff --git a/src/console/zmq/backend/cffi/devices.py b/external_libs/python/zmq/backend/cffi/devices.py
index c7a514a8..c7a514a8 100755..100644
--- a/src/console/zmq/backend/cffi/devices.py
+++ b/external_libs/python/zmq/backend/cffi/devices.py
diff --git a/src/console/zmq/backend/cffi/error.py b/external_libs/python/zmq/backend/cffi/error.py
index 3bb64de0..3bb64de0 100755..100644
--- a/src/console/zmq/backend/cffi/error.py
+++ b/external_libs/python/zmq/backend/cffi/error.py
diff --git a/src/console/zmq/backend/cffi/message.py b/external_libs/python/zmq/backend/cffi/message.py
index c35decb6..c35decb6 100755..100644
--- a/src/console/zmq/backend/cffi/message.py
+++ b/external_libs/python/zmq/backend/cffi/message.py
diff --git a/src/console/zmq/backend/cffi/socket.py b/external_libs/python/zmq/backend/cffi/socket.py
index 3c427739..3c427739 100755..100644
--- a/src/console/zmq/backend/cffi/socket.py
+++ b/external_libs/python/zmq/backend/cffi/socket.py
diff --git a/src/console/zmq/backend/cffi/utils.py b/external_libs/python/zmq/backend/cffi/utils.py
index fde7827b..fde7827b 100755..100644
--- a/src/console/zmq/backend/cffi/utils.py
+++ b/external_libs/python/zmq/backend/cffi/utils.py
diff --git a/src/console/zmq/backend/cython/__init__.py b/external_libs/python/zmq/backend/cython/__init__.py
index e5358185..e5358185 100755..100644
--- a/src/console/zmq/backend/cython/__init__.py
+++ b/external_libs/python/zmq/backend/cython/__init__.py
diff --git a/src/console/zmq/backend/cython/_device.py b/external_libs/python/zmq/backend/cython/_device.py
index 3368ca2c..3368ca2c 100755..100644
--- a/src/console/zmq/backend/cython/_device.py
+++ b/external_libs/python/zmq/backend/cython/_device.py
diff --git a/src/console/zmq/backend/cython/_poll.py b/external_libs/python/zmq/backend/cython/_poll.py
index cb1d5d77..cb1d5d77 100755..100644
--- a/src/console/zmq/backend/cython/_poll.py
+++ b/external_libs/python/zmq/backend/cython/_poll.py
diff --git a/src/console/zmq/backend/cython/_version.py b/external_libs/python/zmq/backend/cython/_version.py
index 08262706..08262706 100755..100644
--- a/src/console/zmq/backend/cython/_version.py
+++ b/external_libs/python/zmq/backend/cython/_version.py
diff --git a/src/console/zmq/backend/cython/checkrc.pxd b/external_libs/python/zmq/backend/cython/checkrc.pxd
index 3bf69fc3..3bf69fc3 100644
--- a/src/console/zmq/backend/cython/checkrc.pxd
+++ b/external_libs/python/zmq/backend/cython/checkrc.pxd
diff --git a/src/console/zmq/backend/cython/constants.py b/external_libs/python/zmq/backend/cython/constants.py
index ea772ac0..ea772ac0 100755..100644
--- a/src/console/zmq/backend/cython/constants.py
+++ b/external_libs/python/zmq/backend/cython/constants.py
diff --git a/src/console/zmq/backend/cython/context.pxd b/external_libs/python/zmq/backend/cython/context.pxd
index 9c9267a5..9c9267a5 100644
--- a/src/console/zmq/backend/cython/context.pxd
+++ b/external_libs/python/zmq/backend/cython/context.pxd
diff --git a/src/console/zmq/backend/cython/context.py b/external_libs/python/zmq/backend/cython/context.py
index 19f8ec7c..19f8ec7c 100755..100644
--- a/src/console/zmq/backend/cython/context.py
+++ b/external_libs/python/zmq/backend/cython/context.py
diff --git a/src/console/zmq/backend/cython/error.py b/external_libs/python/zmq/backend/cython/error.py
index d3a4ea0e..d3a4ea0e 100755..100644
--- a/src/console/zmq/backend/cython/error.py
+++ b/external_libs/python/zmq/backend/cython/error.py
diff --git a/src/console/zmq/backend/cython/libzmq.pxd b/external_libs/python/zmq/backend/cython/libzmq.pxd
index e42f6d6b..e42f6d6b 100644
--- a/src/console/zmq/backend/cython/libzmq.pxd
+++ b/external_libs/python/zmq/backend/cython/libzmq.pxd
diff --git a/src/console/zmq/backend/cython/message.pxd b/external_libs/python/zmq/backend/cython/message.pxd
index 4781195f..4781195f 100644
--- a/src/console/zmq/backend/cython/message.pxd
+++ b/external_libs/python/zmq/backend/cython/message.pxd
diff --git a/src/console/zmq/backend/cython/message.py b/external_libs/python/zmq/backend/cython/message.py
index 5e423b62..5e423b62 100755..100644
--- a/src/console/zmq/backend/cython/message.py
+++ b/external_libs/python/zmq/backend/cython/message.py
diff --git a/src/console/zmq/backend/cython/socket.pxd b/external_libs/python/zmq/backend/cython/socket.pxd
index b8a331e2..b8a331e2 100644
--- a/src/console/zmq/backend/cython/socket.pxd
+++ b/external_libs/python/zmq/backend/cython/socket.pxd
diff --git a/src/console/zmq/backend/cython/socket.py b/external_libs/python/zmq/backend/cython/socket.py
index faef8bee..faef8bee 100755..100644
--- a/src/console/zmq/backend/cython/socket.py
+++ b/external_libs/python/zmq/backend/cython/socket.py
diff --git a/src/console/zmq/backend/cython/utils.pxd b/external_libs/python/zmq/backend/cython/utils.pxd
index 1d7117f1..1d7117f1 100644
--- a/src/console/zmq/backend/cython/utils.pxd
+++ b/external_libs/python/zmq/backend/cython/utils.pxd
diff --git a/src/console/zmq/backend/cython/utils.py b/external_libs/python/zmq/backend/cython/utils.py
index fe928300..fe928300 100755..100644
--- a/src/console/zmq/backend/cython/utils.py
+++ b/external_libs/python/zmq/backend/cython/utils.py
diff --git a/src/console/zmq/backend/select.py b/external_libs/python/zmq/backend/select.py
index 0a2e09a2..0a2e09a2 100755..100644
--- a/src/console/zmq/backend/select.py
+++ b/external_libs/python/zmq/backend/select.py
diff --git a/src/console/zmq/devices/__init__.py b/external_libs/python/zmq/devices/__init__.py
index 23715963..23715963 100755..100644
--- a/src/console/zmq/devices/__init__.py
+++ b/external_libs/python/zmq/devices/__init__.py
diff --git a/src/console/zmq/devices/basedevice.py b/external_libs/python/zmq/devices/basedevice.py
index 7ba1b7ac..7ba1b7ac 100755..100644
--- a/src/console/zmq/devices/basedevice.py
+++ b/external_libs/python/zmq/devices/basedevice.py
diff --git a/src/console/zmq/devices/monitoredqueue.pxd b/external_libs/python/zmq/devices/monitoredqueue.pxd
index 1e26ed86..1e26ed86 100644
--- a/src/console/zmq/devices/monitoredqueue.pxd
+++ b/external_libs/python/zmq/devices/monitoredqueue.pxd
diff --git a/src/console/zmq/devices/monitoredqueue.py b/external_libs/python/zmq/devices/monitoredqueue.py
index 6d714e51..6d714e51 100755..100644
--- a/src/console/zmq/devices/monitoredqueue.py
+++ b/external_libs/python/zmq/devices/monitoredqueue.py
diff --git a/src/console/zmq/devices/monitoredqueuedevice.py b/external_libs/python/zmq/devices/monitoredqueuedevice.py
index 9723f866..9723f866 100755..100644
--- a/src/console/zmq/devices/monitoredqueuedevice.py
+++ b/external_libs/python/zmq/devices/monitoredqueuedevice.py
diff --git a/src/console/zmq/devices/proxydevice.py b/external_libs/python/zmq/devices/proxydevice.py
index 68be3f15..68be3f15 100755..100644
--- a/src/console/zmq/devices/proxydevice.py
+++ b/external_libs/python/zmq/devices/proxydevice.py
diff --git a/src/console/zmq/error.py b/external_libs/python/zmq/error.py
index 48cdaafa..48cdaafa 100755..100644
--- a/src/console/zmq/error.py
+++ b/external_libs/python/zmq/error.py
diff --git a/src/console/zmq/eventloop/__init__.py b/external_libs/python/zmq/eventloop/__init__.py
index 568e8e8d..568e8e8d 100755..100644
--- a/src/console/zmq/eventloop/__init__.py
+++ b/external_libs/python/zmq/eventloop/__init__.py
diff --git a/src/console/zmq/eventloop/ioloop.py b/external_libs/python/zmq/eventloop/ioloop.py
index 35f4c418..35f4c418 100755..100644
--- a/src/console/zmq/eventloop/ioloop.py
+++ b/external_libs/python/zmq/eventloop/ioloop.py
diff --git a/src/console/zmq/eventloop/minitornado/__init__.py b/external_libs/python/zmq/eventloop/minitornado/__init__.py
index e69de29b..e69de29b 100644
--- a/src/console/zmq/eventloop/minitornado/__init__.py
+++ b/external_libs/python/zmq/eventloop/minitornado/__init__.py
diff --git a/src/console/zmq/eventloop/minitornado/concurrent.py b/external_libs/python/zmq/eventloop/minitornado/concurrent.py
index 519b23d5..519b23d5 100755..100644
--- a/src/console/zmq/eventloop/minitornado/concurrent.py
+++ b/external_libs/python/zmq/eventloop/minitornado/concurrent.py
diff --git a/src/console/zmq/eventloop/minitornado/ioloop.py b/external_libs/python/zmq/eventloop/minitornado/ioloop.py
index 710a3ecb..710a3ecb 100755..100644
--- a/src/console/zmq/eventloop/minitornado/ioloop.py
+++ b/external_libs/python/zmq/eventloop/minitornado/ioloop.py
diff --git a/src/console/zmq/eventloop/minitornado/log.py b/external_libs/python/zmq/eventloop/minitornado/log.py
index 49051e89..49051e89 100755..100644
--- a/src/console/zmq/eventloop/minitornado/log.py
+++ b/external_libs/python/zmq/eventloop/minitornado/log.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/__init__.py b/external_libs/python/zmq/eventloop/minitornado/platform/__init__.py
index e69de29b..e69de29b 100644
--- a/src/console/zmq/eventloop/minitornado/platform/__init__.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/__init__.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/auto.py b/external_libs/python/zmq/eventloop/minitornado/platform/auto.py
index b40ccd94..b40ccd94 100755..100644
--- a/src/console/zmq/eventloop/minitornado/platform/auto.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/auto.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/common.py b/external_libs/python/zmq/eventloop/minitornado/platform/common.py
index 2d75dc1e..2d75dc1e 100755..100644
--- a/src/console/zmq/eventloop/minitornado/platform/common.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/common.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/interface.py b/external_libs/python/zmq/eventloop/minitornado/platform/interface.py
index 07da6bab..07da6bab 100755..100644
--- a/src/console/zmq/eventloop/minitornado/platform/interface.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/interface.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/posix.py b/external_libs/python/zmq/eventloop/minitornado/platform/posix.py
index ccffbb66..ccffbb66 100755..100644
--- a/src/console/zmq/eventloop/minitornado/platform/posix.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/posix.py
diff --git a/src/console/zmq/eventloop/minitornado/platform/windows.py b/external_libs/python/zmq/eventloop/minitornado/platform/windows.py
index 817bdca1..817bdca1 100755..100644
--- a/src/console/zmq/eventloop/minitornado/platform/windows.py
+++ b/external_libs/python/zmq/eventloop/minitornado/platform/windows.py
diff --git a/src/console/zmq/eventloop/minitornado/stack_context.py b/external_libs/python/zmq/eventloop/minitornado/stack_context.py
index 226d8042..226d8042 100755..100644
--- a/src/console/zmq/eventloop/minitornado/stack_context.py
+++ b/external_libs/python/zmq/eventloop/minitornado/stack_context.py
diff --git a/src/console/zmq/eventloop/minitornado/util.py b/external_libs/python/zmq/eventloop/minitornado/util.py
index c1e2eb95..c1e2eb95 100755..100644
--- a/src/console/zmq/eventloop/minitornado/util.py
+++ b/external_libs/python/zmq/eventloop/minitornado/util.py
diff --git a/src/console/zmq/eventloop/zmqstream.py b/external_libs/python/zmq/eventloop/zmqstream.py
index 86a97e44..86a97e44 100755..100644
--- a/src/console/zmq/eventloop/zmqstream.py
+++ b/external_libs/python/zmq/eventloop/zmqstream.py
diff --git a/src/console/zmq/green/__init__.py b/external_libs/python/zmq/green/__init__.py
index ff7e5965..ff7e5965 100755..100644
--- a/src/console/zmq/green/__init__.py
+++ b/external_libs/python/zmq/green/__init__.py
diff --git a/src/console/zmq/green/core.py b/external_libs/python/zmq/green/core.py
index 9fc73e32..9fc73e32 100755..100644
--- a/src/console/zmq/green/core.py
+++ b/external_libs/python/zmq/green/core.py
diff --git a/src/console/zmq/green/device.py b/external_libs/python/zmq/green/device.py
index 4b070237..4b070237 100755..100644
--- a/src/console/zmq/green/device.py
+++ b/external_libs/python/zmq/green/device.py
diff --git a/src/console/zmq/green/eventloop/__init__.py b/external_libs/python/zmq/green/eventloop/__init__.py
index c5150efe..c5150efe 100755..100644
--- a/src/console/zmq/green/eventloop/__init__.py
+++ b/external_libs/python/zmq/green/eventloop/__init__.py
diff --git a/src/console/zmq/green/eventloop/ioloop.py b/external_libs/python/zmq/green/eventloop/ioloop.py
index e12fd5e9..e12fd5e9 100755..100644
--- a/src/console/zmq/green/eventloop/ioloop.py
+++ b/external_libs/python/zmq/green/eventloop/ioloop.py
diff --git a/src/console/zmq/green/eventloop/zmqstream.py b/external_libs/python/zmq/green/eventloop/zmqstream.py
index 90fbd1f5..90fbd1f5 100755..100644
--- a/src/console/zmq/green/eventloop/zmqstream.py
+++ b/external_libs/python/zmq/green/eventloop/zmqstream.py
diff --git a/src/console/zmq/green/poll.py b/external_libs/python/zmq/green/poll.py
index 8f016129..8f016129 100755..100644
--- a/src/console/zmq/green/poll.py
+++ b/external_libs/python/zmq/green/poll.py
diff --git a/src/console/zmq/log/__init__.py b/external_libs/python/zmq/log/__init__.py
index e69de29b..e69de29b 100644
--- a/src/console/zmq/log/__init__.py
+++ b/external_libs/python/zmq/log/__init__.py
diff --git a/src/console/zmq/log/handlers.py b/external_libs/python/zmq/log/handlers.py
index 5ff21bf3..5ff21bf3 100755..100644
--- a/src/console/zmq/log/handlers.py
+++ b/external_libs/python/zmq/log/handlers.py
diff --git a/src/console/zmq/ssh/__init__.py b/external_libs/python/zmq/ssh/__init__.py
index 57f09568..57f09568 100755..100644
--- a/src/console/zmq/ssh/__init__.py
+++ b/external_libs/python/zmq/ssh/__init__.py
diff --git a/src/console/zmq/ssh/forward.py b/external_libs/python/zmq/ssh/forward.py
index 2d619462..2d619462 100755..100644
--- a/src/console/zmq/ssh/forward.py
+++ b/external_libs/python/zmq/ssh/forward.py
diff --git a/src/console/zmq/ssh/tunnel.py b/external_libs/python/zmq/ssh/tunnel.py
index 5a0c5433..5a0c5433 100755..100644
--- a/src/console/zmq/ssh/tunnel.py
+++ b/external_libs/python/zmq/ssh/tunnel.py
diff --git a/src/console/zmq/sugar/__init__.py b/external_libs/python/zmq/sugar/__init__.py
index d0510a44..d0510a44 100755..100644
--- a/src/console/zmq/sugar/__init__.py
+++ b/external_libs/python/zmq/sugar/__init__.py
diff --git a/src/console/zmq/sugar/attrsettr.py b/external_libs/python/zmq/sugar/attrsettr.py
index 4bbd36d6..4bbd36d6 100755..100644
--- a/src/console/zmq/sugar/attrsettr.py
+++ b/external_libs/python/zmq/sugar/attrsettr.py
diff --git a/src/console/zmq/sugar/constants.py b/external_libs/python/zmq/sugar/constants.py
index 88281176..88281176 100755..100644
--- a/src/console/zmq/sugar/constants.py
+++ b/external_libs/python/zmq/sugar/constants.py
diff --git a/src/console/zmq/sugar/context.py b/external_libs/python/zmq/sugar/context.py
index 86a9c5dc..86a9c5dc 100755..100644
--- a/src/console/zmq/sugar/context.py
+++ b/external_libs/python/zmq/sugar/context.py
diff --git a/src/console/zmq/sugar/frame.py b/external_libs/python/zmq/sugar/frame.py
index 9f556c86..9f556c86 100755..100644
--- a/src/console/zmq/sugar/frame.py
+++ b/external_libs/python/zmq/sugar/frame.py
diff --git a/src/console/zmq/sugar/poll.py b/external_libs/python/zmq/sugar/poll.py
index c7b1d1bb..c7b1d1bb 100755..100644
--- a/src/console/zmq/sugar/poll.py
+++ b/external_libs/python/zmq/sugar/poll.py
diff --git a/src/console/zmq/sugar/socket.py b/external_libs/python/zmq/sugar/socket.py
index c91589d7..c91589d7 100755..100644
--- a/src/console/zmq/sugar/socket.py
+++ b/external_libs/python/zmq/sugar/socket.py
diff --git a/src/console/zmq/sugar/tracker.py b/external_libs/python/zmq/sugar/tracker.py
index fb8c007f..fb8c007f 100755..100644
--- a/src/console/zmq/sugar/tracker.py
+++ b/external_libs/python/zmq/sugar/tracker.py
diff --git a/src/console/zmq/sugar/version.py b/external_libs/python/zmq/sugar/version.py
index ea8fbbc4..ea8fbbc4 100755..100644
--- a/src/console/zmq/sugar/version.py
+++ b/external_libs/python/zmq/sugar/version.py
diff --git a/src/console/zmq/tests/__init__.py b/external_libs/python/zmq/tests/__init__.py
index 325a3f19..325a3f19 100755..100644
--- a/src/console/zmq/tests/__init__.py
+++ b/external_libs/python/zmq/tests/__init__.py
diff --git a/src/console/zmq/tests/test_auth.py b/external_libs/python/zmq/tests/test_auth.py
index d350f61f..d350f61f 100755..100644
--- a/src/console/zmq/tests/test_auth.py
+++ b/external_libs/python/zmq/tests/test_auth.py
diff --git a/src/console/zmq/tests/test_cffi_backend.py b/external_libs/python/zmq/tests/test_cffi_backend.py
index 1f85eebf..1f85eebf 100755..100644
--- a/src/console/zmq/tests/test_cffi_backend.py
+++ b/external_libs/python/zmq/tests/test_cffi_backend.py
diff --git a/src/console/zmq/tests/test_constants.py b/external_libs/python/zmq/tests/test_constants.py
index d32b2b48..d32b2b48 100755..100644
--- a/src/console/zmq/tests/test_constants.py
+++ b/external_libs/python/zmq/tests/test_constants.py
diff --git a/src/console/zmq/tests/test_context.py b/external_libs/python/zmq/tests/test_context.py
index e3280778..e3280778 100755..100644
--- a/src/console/zmq/tests/test_context.py
+++ b/external_libs/python/zmq/tests/test_context.py
diff --git a/src/console/zmq/tests/test_device.py b/external_libs/python/zmq/tests/test_device.py
index f8305074..f8305074 100755..100644
--- a/src/console/zmq/tests/test_device.py
+++ b/external_libs/python/zmq/tests/test_device.py
diff --git a/src/console/zmq/tests/test_error.py b/external_libs/python/zmq/tests/test_error.py
index a2eee14a..a2eee14a 100755..100644
--- a/src/console/zmq/tests/test_error.py
+++ b/external_libs/python/zmq/tests/test_error.py
diff --git a/src/console/zmq/tests/test_etc.py b/external_libs/python/zmq/tests/test_etc.py
index ad224064..ad224064 100755..100644
--- a/src/console/zmq/tests/test_etc.py
+++ b/external_libs/python/zmq/tests/test_etc.py
diff --git a/src/console/zmq/tests/test_imports.py b/external_libs/python/zmq/tests/test_imports.py
index c0ddfaac..c0ddfaac 100755..100644
--- a/src/console/zmq/tests/test_imports.py
+++ b/external_libs/python/zmq/tests/test_imports.py
diff --git a/src/console/zmq/tests/test_ioloop.py b/external_libs/python/zmq/tests/test_ioloop.py
index 2a8b1153..2a8b1153 100755..100644
--- a/src/console/zmq/tests/test_ioloop.py
+++ b/external_libs/python/zmq/tests/test_ioloop.py
diff --git a/src/console/zmq/tests/test_log.py b/external_libs/python/zmq/tests/test_log.py
index 9206f095..9206f095 100755..100644
--- a/src/console/zmq/tests/test_log.py
+++ b/external_libs/python/zmq/tests/test_log.py
diff --git a/src/console/zmq/tests/test_message.py b/external_libs/python/zmq/tests/test_message.py
index d8770bdf..d8770bdf 100755..100644
--- a/src/console/zmq/tests/test_message.py
+++ b/external_libs/python/zmq/tests/test_message.py
diff --git a/src/console/zmq/tests/test_monitor.py b/external_libs/python/zmq/tests/test_monitor.py
index 4f035388..4f035388 100755..100644
--- a/src/console/zmq/tests/test_monitor.py
+++ b/external_libs/python/zmq/tests/test_monitor.py
diff --git a/src/console/zmq/tests/test_monqueue.py b/external_libs/python/zmq/tests/test_monqueue.py
index e855602e..e855602e 100755..100644
--- a/src/console/zmq/tests/test_monqueue.py
+++ b/external_libs/python/zmq/tests/test_monqueue.py
diff --git a/src/console/zmq/tests/test_multipart.py b/external_libs/python/zmq/tests/test_multipart.py
index 24d41be0..24d41be0 100755..100644
--- a/src/console/zmq/tests/test_multipart.py
+++ b/external_libs/python/zmq/tests/test_multipart.py
diff --git a/src/console/zmq/tests/test_pair.py b/external_libs/python/zmq/tests/test_pair.py
index e88c1e8b..e88c1e8b 100755..100644
--- a/src/console/zmq/tests/test_pair.py
+++ b/external_libs/python/zmq/tests/test_pair.py
diff --git a/src/console/zmq/tests/test_poll.py b/external_libs/python/zmq/tests/test_poll.py
index 57346c89..57346c89 100755..100644
--- a/src/console/zmq/tests/test_poll.py
+++ b/external_libs/python/zmq/tests/test_poll.py
diff --git a/src/console/zmq/tests/test_pubsub.py b/external_libs/python/zmq/tests/test_pubsub.py
index a3ee22aa..a3ee22aa 100755..100644
--- a/src/console/zmq/tests/test_pubsub.py
+++ b/external_libs/python/zmq/tests/test_pubsub.py
diff --git a/src/console/zmq/tests/test_reqrep.py b/external_libs/python/zmq/tests/test_reqrep.py
index de17f2b3..de17f2b3 100755..100644
--- a/src/console/zmq/tests/test_reqrep.py
+++ b/external_libs/python/zmq/tests/test_reqrep.py
diff --git a/src/console/zmq/tests/test_security.py b/external_libs/python/zmq/tests/test_security.py
index 687b7e0f..687b7e0f 100755..100644
--- a/src/console/zmq/tests/test_security.py
+++ b/external_libs/python/zmq/tests/test_security.py
diff --git a/src/console/zmq/tests/test_socket.py b/external_libs/python/zmq/tests/test_socket.py
index 5c842edc..5c842edc 100755..100644
--- a/src/console/zmq/tests/test_socket.py
+++ b/external_libs/python/zmq/tests/test_socket.py
diff --git a/src/console/zmq/tests/test_stopwatch.py b/external_libs/python/zmq/tests/test_stopwatch.py
index 49fb79f2..49fb79f2 100755..100644
--- a/src/console/zmq/tests/test_stopwatch.py
+++ b/external_libs/python/zmq/tests/test_stopwatch.py
diff --git a/src/console/zmq/tests/test_version.py b/external_libs/python/zmq/tests/test_version.py
index 6ebebf30..6ebebf30 100755..100644
--- a/src/console/zmq/tests/test_version.py
+++ b/external_libs/python/zmq/tests/test_version.py
diff --git a/src/console/zmq/tests/test_win32_shim.py b/external_libs/python/zmq/tests/test_win32_shim.py
index 55657bda..55657bda 100755..100644
--- a/src/console/zmq/tests/test_win32_shim.py
+++ b/external_libs/python/zmq/tests/test_win32_shim.py
diff --git a/src/console/zmq/tests/test_z85.py b/external_libs/python/zmq/tests/test_z85.py
index 8a73cb4d..8a73cb4d 100755..100644
--- a/src/console/zmq/tests/test_z85.py
+++ b/external_libs/python/zmq/tests/test_z85.py
diff --git a/src/console/zmq/tests/test_zmqstream.py b/external_libs/python/zmq/tests/test_zmqstream.py
index cdb3a171..cdb3a171 100755..100644
--- a/src/console/zmq/tests/test_zmqstream.py
+++ b/external_libs/python/zmq/tests/test_zmqstream.py
diff --git a/src/console/zmq/utils/__init__.py b/external_libs/python/zmq/utils/__init__.py
index e69de29b..e69de29b 100644
--- a/src/console/zmq/utils/__init__.py
+++ b/external_libs/python/zmq/utils/__init__.py
diff --git a/src/console/zmq/utils/buffers.pxd b/external_libs/python/zmq/utils/buffers.pxd
index 998aa551..998aa551 100644
--- a/src/console/zmq/utils/buffers.pxd
+++ b/external_libs/python/zmq/utils/buffers.pxd
diff --git a/src/console/zmq/utils/compiler.json b/external_libs/python/zmq/utils/compiler.json
index e58fc130..e58fc130 100644
--- a/src/console/zmq/utils/compiler.json
+++ b/external_libs/python/zmq/utils/compiler.json
diff --git a/src/console/zmq/utils/config.json b/external_libs/python/zmq/utils/config.json
index 1e4611f9..1e4611f9 100644
--- a/src/console/zmq/utils/config.json
+++ b/external_libs/python/zmq/utils/config.json
diff --git a/src/console/zmq/utils/constant_names.py b/external_libs/python/zmq/utils/constant_names.py
index 47da9dc2..47da9dc2 100755..100644
--- a/src/console/zmq/utils/constant_names.py
+++ b/external_libs/python/zmq/utils/constant_names.py
diff --git a/src/console/zmq/utils/garbage.py b/external_libs/python/zmq/utils/garbage.py
index 80a8725a..80a8725a 100755..100644
--- a/src/console/zmq/utils/garbage.py
+++ b/external_libs/python/zmq/utils/garbage.py
diff --git a/src/console/zmq/utils/getpid_compat.h b/external_libs/python/zmq/utils/getpid_compat.h
index 47ce90fa..47ce90fa 100644
--- a/src/console/zmq/utils/getpid_compat.h
+++ b/external_libs/python/zmq/utils/getpid_compat.h
diff --git a/src/console/zmq/utils/interop.py b/external_libs/python/zmq/utils/interop.py
index 26c01969..26c01969 100755..100644
--- a/src/console/zmq/utils/interop.py
+++ b/external_libs/python/zmq/utils/interop.py
diff --git a/src/console/zmq/utils/ipcmaxlen.h b/external_libs/python/zmq/utils/ipcmaxlen.h
index 7218db78..7218db78 100644
--- a/src/console/zmq/utils/ipcmaxlen.h
+++ b/external_libs/python/zmq/utils/ipcmaxlen.h
diff --git a/src/console/zmq/utils/jsonapi.py b/external_libs/python/zmq/utils/jsonapi.py
index 865ca6d5..865ca6d5 100755..100644
--- a/src/console/zmq/utils/jsonapi.py
+++ b/external_libs/python/zmq/utils/jsonapi.py
diff --git a/src/console/zmq/utils/monitor.py b/external_libs/python/zmq/utils/monitor.py
index 734d54b1..734d54b1 100755..100644
--- a/src/console/zmq/utils/monitor.py
+++ b/external_libs/python/zmq/utils/monitor.py
diff --git a/src/console/zmq/utils/pyversion_compat.h b/external_libs/python/zmq/utils/pyversion_compat.h
index fac09046..fac09046 100644
--- a/src/console/zmq/utils/pyversion_compat.h
+++ b/external_libs/python/zmq/utils/pyversion_compat.h
diff --git a/src/console/zmq/utils/sixcerpt.py b/external_libs/python/zmq/utils/sixcerpt.py
index 5492fd59..5492fd59 100755..100644
--- a/src/console/zmq/utils/sixcerpt.py
+++ b/external_libs/python/zmq/utils/sixcerpt.py
diff --git a/src/console/zmq/utils/strtypes.py b/external_libs/python/zmq/utils/strtypes.py
index 548410dc..548410dc 100755..100644
--- a/src/console/zmq/utils/strtypes.py
+++ b/external_libs/python/zmq/utils/strtypes.py
diff --git a/src/console/zmq/utils/win32.py b/external_libs/python/zmq/utils/win32.py
index ea758299..ea758299 100755..100644
--- a/src/console/zmq/utils/win32.py
+++ b/external_libs/python/zmq/utils/win32.py
diff --git a/src/console/zmq/utils/z85.py b/external_libs/python/zmq/utils/z85.py
index 1bb1784e..1bb1784e 100755..100644
--- a/src/console/zmq/utils/z85.py
+++ b/external_libs/python/zmq/utils/z85.py
diff --git a/src/console/zmq/utils/zmq_compat.h b/external_libs/python/zmq/utils/zmq_compat.h
index 81c57b69..81c57b69 100644
--- a/src/console/zmq/utils/zmq_compat.h
+++ b/external_libs/python/zmq/utils/zmq_compat.h
diff --git a/src/console/zmq/utils/zmq_constants.h b/external_libs/python/zmq/utils/zmq_constants.h
index 97683022..97683022 100644
--- a/src/console/zmq/utils/zmq_constants.h
+++ b/external_libs/python/zmq/utils/zmq_constants.h
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/PKG-INFO b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/PKG-INFO
deleted file mode 100755
index 7082747b..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/PKG-INFO
+++ /dev/null
@@ -1,10 +0,0 @@
-Metadata-Version: 1.0
-Name: jsonrpclib
-Version: 0.1.3
-Summary: This project is an implementation of the JSON-RPC v2.0 specification (backwards-compatible) as a client library.
-Home-page: http://github.com/joshmarshall/jsonrpclib/
-Author: Josh Marshall
-Author-email: catchjosh@gmail.com
-License: http://www.apache.org/licenses/LICENSE-2.0
-Description: UNKNOWN
-Platform: UNKNOWN
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/README.txt b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/README.txt
deleted file mode 100755
index 9d431a48..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/README.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-JSONRPClib
-==========
-This library is an implementation of the JSON-RPC specification.
-It supports both the original 1.0 specification, as well as the
-new (proposed) 2.0 spec, which includes batch submission, keyword
-arguments, etc.
-
-It is licensed under the Apache License, Version 2.0
-(http://www.apache.org/licenses/LICENSE-2.0.html).
-
-Communication
--------------
-Feel free to send any questions, comments, or patches to our Google Group
-mailing list (you'll need to join to send a message):
-http://groups.google.com/group/jsonrpclib
-
-Summary
--------
-This library implements the JSON-RPC 2.0 proposed specification in pure Python.
-It is designed to be as compatible with the syntax of xmlrpclib as possible
-(it extends where possible), so that projects using xmlrpclib could easily be
-modified to use JSON and experiment with the differences.
-
-It is backwards-compatible with the 1.0 specification, and supports all of the
-new proposed features of 2.0, including:
-
-* Batch submission (via MultiCall)
-* Keyword arguments
-* Notifications (both in a batch and 'normal')
-* Class translation using the 'jsonclass' key.
-
-I've added a "SimpleJSONRPCServer", which is intended to emulate the
-"SimpleXMLRPCServer" from the default Python distribution.
-
-Requirements
-------------
-It supports cjson and simplejson, and looks for the parsers in that order
-(searching first for cjson, then for the "built-in" simplejson as json in 2.6+,
-and then the simplejson external library). One of these must be installed to
-use this library, although if you have a standard distribution of 2.6+, you
-should already have one. Keep in mind that cjson is supposed to be the
-quickest, I believe, so if you are going for full-on optimization you may
-want to pick it up.
-
-Client Usage
-------------
-
-This is (obviously) taken from a console session.
-
- >>> import jsonrpclib
- >>> server = jsonrpclib.Server('http://localhost:8080')
- >>> server.add(5,6)
- 11
- >>> print jsonrpclib.history.request
- {"jsonrpc": "2.0", "params": [5, 6], "id": "gb3c9g37", "method": "add"}
- >>> print jsonrpclib.history.response
- {'jsonrpc': '2.0', 'result': 11, 'id': 'gb3c9g37'}
- >>> server.add(x=5, y=10)
- 15
- >>> server._notify.add(5,6)
- # No result returned...
- >>> batch = jsonrpclib.MultiCall(server)
- >>> batch.add(5, 6)
- >>> batch.ping({'key':'value'})
- >>> batch._notify.add(4, 30)
- >>> results = batch()
- >>> for result in results:
- >>> ... print result
- 11
- {'key': 'value'}
- # Note that there are only two responses -- this is according to spec.
-
-If you need 1.0 functionality, there are a bunch of places you can pass that
-in, although the best is just to change the value on
-jsonrpclib.config.version:
-
- >>> import jsonrpclib
- >>> jsonrpclib.config.version
- 2.0
- >>> jsonrpclib.config.version = 1.0
- >>> server = jsonrpclib.Server('http://localhost:8080')
- >>> server.add(7, 10)
- 17
- >>> print jsonrpclib..history.request
- {"params": [7, 10], "id": "thes7tl2", "method": "add"}
- >>> print jsonrpclib.history.response
- {'id': 'thes7tl2', 'result': 17, 'error': None}
- >>>
-
-The equivalent loads and dumps functions also exist, although with minor
-modifications. The dumps arguments are almost identical, but it adds three
-arguments: rpcid for the 'id' key, version to specify the JSON-RPC
-compatibility, and notify if it's a request that you want to be a
-notification.
-
-Additionally, the loads method does not return the params and method like
-xmlrpclib, but instead a.) parses for errors, raising ProtocolErrors, and
-b.) returns the entire structure of the request / response for manual parsing.
-
-SimpleJSONRPCServer
--------------------
-This is identical in usage (or should be) to the SimpleXMLRPCServer in the default Python install. Some of the differences in features are that it obviously supports notification, batch calls, class translation (if left on), etc. Note: The import line is slightly different from the regular SimpleXMLRPCServer, since the SimpleJSONRPCServer is distributed within the jsonrpclib library.
-
- from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
-
- server = SimpleJSONRPCServer(('localhost', 8080))
- server.register_function(pow)
- server.register_function(lambda x,y: x+y, 'add')
- server.register_function(lambda x: x, 'ping')
- server.serve_forever()
-
-Class Translation
------------------
-I've recently added "automatic" class translation support, although it is
-turned off by default. This can be devastatingly slow if improperly used, so
-the following is just a short list of things to keep in mind when using it.
-
-* Keep It (the object) Simple Stupid. (for exceptions, keep reading.)
-* Do not require init params (for exceptions, keep reading)
-* Getter properties without setters could be dangerous (read: not tested)
-
-If any of the above are issues, use the _serialize method. (see usage below)
-The server and client must BOTH have use_jsonclass configuration item on and
-they must both have access to the same libraries used by the objects for
-this to work.
-
-If you have excessively nested arguments, it would be better to turn off the
-translation and manually invoke it on specific objects using
-jsonrpclib.jsonclass.dump / jsonrpclib.jsonclass.load (since the default
-behavior recursively goes through attributes and lists / dicts / tuples).
-
-[test_obj.py]
-
- # This object is /very/ simple, and the system will look through the
- # attributes and serialize what it can.
- class TestObj(object):
- foo = 'bar'
-
- # This object requires __init__ params, so it uses the _serialize method
- # and returns a tuple of init params and attribute values (the init params
- # can be a dict or a list, but the attribute values must be a dict.)
- class TestSerial(object):
- foo = 'bar'
- def __init__(self, *args):
- self.args = args
- def _serialize(self):
- return (self.args, {'foo':self.foo,})
-
-[usage]
-
- import jsonrpclib
- import test_obj
-
- jsonrpclib.config.use_jsonclass = True
-
- testobj1 = test_obj.TestObj()
- testobj2 = test_obj.TestSerial()
- server = jsonrpclib.Server('http://localhost:8080')
- # The 'ping' just returns whatever is sent
- ping1 = server.ping(testobj1)
- ping2 = server.ping(testobj2)
- print jsonrpclib.history.request
- # {"jsonrpc": "2.0", "params": [{"__jsonclass__": ["test_obj.TestSerial", ["foo"]]}], "id": "a0l976iv", "method": "ping"}
- print jsonrpclib.history.result
- # {'jsonrpc': '2.0', 'result': <test_obj.TestSerial object at 0x2744590>, 'id': 'a0l976iv'}
-
-To turn on this behaviour, just set jsonrpclib.config.use_jsonclass to True.
-If you want to use a different method for serialization, just set
-jsonrpclib.config.serialize_method to the method name. Finally, if you are
-using classes that you have defined in the implementation (as in, not a
-separate library), you'll need to add those (on BOTH the server and the
-client) using the jsonrpclib.config.classes.add() method.
-(Examples forthcoming.)
-
-Feedback on this "feature" is very, VERY much appreciated.
-
-Why JSON-RPC?
--------------
-In my opinion, there are several reasons to choose JSON over XML for RPC:
-
-* Much simpler to read (I suppose this is opinion, but I know I'm right. :)
-* Size / Bandwidth - Main reason, a JSON object representation is just much smaller.
-* Parsing - JSON should be much quicker to parse than XML.
-* Easy class passing with jsonclass (when enabled)
-
-In the interest of being fair, there are also a few reasons to choose XML
-over JSON:
-
-* Your server doesn't do JSON (rather obvious)
-* Wider XML-RPC support across APIs (can we change this? :))
-* Libraries are more established, i.e. more stable (Let's change this too.)
-
-TESTS
------
-I've dropped almost-verbatim tests from the JSON-RPC spec 2.0 page.
-You can run it with:
-
- python tests.py
-
-TODO
-----
-* Use HTTP error codes on SimpleJSONRPCServer
-* Test, test, test and optimize \ No newline at end of file
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/SimpleJSONRPCServer.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/SimpleJSONRPCServer.py
deleted file mode 100755
index d76da73e..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/SimpleJSONRPCServer.py
+++ /dev/null
@@ -1,229 +0,0 @@
-import jsonrpclib
-from jsonrpclib import Fault
-from jsonrpclib.jsonrpc import USE_UNIX_SOCKETS
-import SimpleXMLRPCServer
-import SocketServer
-import socket
-import logging
-import os
-import types
-import traceback
-import sys
-try:
- import fcntl
-except ImportError:
- # For Windows
- fcntl = None
-
-def get_version(request):
- # must be a dict
- if 'jsonrpc' in request.keys():
- return 2.0
- if 'id' in request.keys():
- return 1.0
- return None
-
-def validate_request(request):
- if type(request) is not types.DictType:
- fault = Fault(
- -32600, 'Request must be {}, not %s.' % type(request)
- )
- return fault
- rpcid = request.get('id', None)
- version = get_version(request)
- if not version:
- fault = Fault(-32600, 'Request %s invalid.' % request, rpcid=rpcid)
- return fault
- request.setdefault('params', [])
- method = request.get('method', None)
- params = request.get('params')
- param_types = (types.ListType, types.DictType, types.TupleType)
- if not method or type(method) not in types.StringTypes or \
- type(params) not in param_types:
- fault = Fault(
- -32600, 'Invalid request parameters or method.', rpcid=rpcid
- )
- return fault
- return True
-
-class SimpleJSONRPCDispatcher(SimpleXMLRPCServer.SimpleXMLRPCDispatcher):
-
- def __init__(self, encoding=None):
- SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self,
- allow_none=True,
- encoding=encoding)
-
- def _marshaled_dispatch(self, data, dispatch_method = None):
- response = None
- try:
- request = jsonrpclib.loads(data)
- except Exception, e:
- fault = Fault(-32700, 'Request %s invalid. (%s)' % (data, e))
- response = fault.response()
- return response
- if not request:
- fault = Fault(-32600, 'Request invalid -- no request data.')
- return fault.response()
- if type(request) is types.ListType:
- # This SHOULD be a batch, by spec
- responses = []
- for req_entry in request:
- result = validate_request(req_entry)
- if type(result) is Fault:
- responses.append(result.response())
- continue
- resp_entry = self._marshaled_single_dispatch(req_entry)
- if resp_entry is not None:
- responses.append(resp_entry)
- if len(responses) > 0:
- response = '[%s]' % ','.join(responses)
- else:
- response = ''
- else:
- result = validate_request(request)
- if type(result) is Fault:
- return result.response()
- response = self._marshaled_single_dispatch(request)
- return response
-
- def _marshaled_single_dispatch(self, request):
- # TODO - Use the multiprocessing and skip the response if
- # it is a notification
- # Put in support for custom dispatcher here
- # (See SimpleXMLRPCServer._marshaled_dispatch)
- method = request.get('method')
- params = request.get('params')
- try:
- response = self._dispatch(method, params)
- except:
- exc_type, exc_value, exc_tb = sys.exc_info()
- fault = Fault(-32603, '%s:%s' % (exc_type, exc_value))
- return fault.response()
- if 'id' not in request.keys() or request['id'] == None:
- # It's a notification
- return None
- try:
- response = jsonrpclib.dumps(response,
- methodresponse=True,
- rpcid=request['id']
- )
- return response
- except:
- exc_type, exc_value, exc_tb = sys.exc_info()
- fault = Fault(-32603, '%s:%s' % (exc_type, exc_value))
- return fault.response()
-
- def _dispatch(self, method, params):
- func = None
- try:
- func = self.funcs[method]
- except KeyError:
- if self.instance is not None:
- if hasattr(self.instance, '_dispatch'):
- return self.instance._dispatch(method, params)
- else:
- try:
- func = SimpleXMLRPCServer.resolve_dotted_attribute(
- self.instance,
- method,
- True
- )
- except AttributeError:
- pass
- if func is not None:
- try:
- if type(params) is types.ListType:
- response = func(*params)
- else:
- response = func(**params)
- return response
- except TypeError:
- return Fault(-32602, 'Invalid parameters.')
- except:
- err_lines = traceback.format_exc().splitlines()
- trace_string = '%s | %s' % (err_lines[-3], err_lines[-1])
- fault = jsonrpclib.Fault(-32603, 'Server error: %s' %
- trace_string)
- return fault
- else:
- return Fault(-32601, 'Method %s not supported.' % method)
-
-class SimpleJSONRPCRequestHandler(
- SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
-
- def do_POST(self):
- if not self.is_rpc_path_valid():
- self.report_404()
- return
- try:
- max_chunk_size = 10*1024*1024
- size_remaining = int(self.headers["content-length"])
- L = []
- while size_remaining:
- chunk_size = min(size_remaining, max_chunk_size)
- L.append(self.rfile.read(chunk_size))
- size_remaining -= len(L[-1])
- data = ''.join(L)
- response = self.server._marshaled_dispatch(data)
- self.send_response(200)
- except Exception, e:
- self.send_response(500)
- err_lines = traceback.format_exc().splitlines()
- trace_string = '%s | %s' % (err_lines[-3], err_lines[-1])
- fault = jsonrpclib.Fault(-32603, 'Server error: %s' % trace_string)
- response = fault.response()
- if response == None:
- response = ''
- self.send_header("Content-type", "application/json-rpc")
- self.send_header("Content-length", str(len(response)))
- self.end_headers()
- self.wfile.write(response)
- self.wfile.flush()
- self.connection.shutdown(1)
-
-class SimpleJSONRPCServer(SocketServer.TCPServer, SimpleJSONRPCDispatcher):
-
- allow_reuse_address = True
-
- def __init__(self, addr, requestHandler=SimpleJSONRPCRequestHandler,
- logRequests=True, encoding=None, bind_and_activate=True,
- address_family=socket.AF_INET):
- self.logRequests = logRequests
- SimpleJSONRPCDispatcher.__init__(self, encoding)
- # TCPServer.__init__ has an extra parameter on 2.6+, so
- # check Python version and decide on how to call it
- vi = sys.version_info
- self.address_family = address_family
- if USE_UNIX_SOCKETS and address_family == socket.AF_UNIX:
- # Unix sockets can't be bound if they already exist in the
- # filesystem. The convention of e.g. X11 is to unlink
- # before binding again.
- if os.path.exists(addr):
- try:
- os.unlink(addr)
- except OSError:
- logging.warning("Could not unlink socket %s", addr)
- # if python 2.5 and lower
- if vi[0] < 3 and vi[1] < 6:
- SocketServer.TCPServer.__init__(self, addr, requestHandler)
- else:
- SocketServer.TCPServer.__init__(self, addr, requestHandler,
- bind_and_activate)
- if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'):
- flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
- flags |= fcntl.FD_CLOEXEC
- fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
-
-class CGIJSONRPCRequestHandler(SimpleJSONRPCDispatcher):
-
- def __init__(self, encoding=None):
- SimpleJSONRPCDispatcher.__init__(self, encoding)
-
- def handle_jsonrpc(self, request_text):
- response = self._marshaled_dispatch(request_text)
- print 'Content-Type: application/json-rpc'
- print 'Content-Length: %d' % len(response)
- print
- sys.stdout.write(response)
-
- handle_xmlrpc = handle_jsonrpc
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/__init__.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/__init__.py
deleted file mode 100755
index 6e884b83..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from jsonrpclib.config import Config
-config = Config.instance()
-from jsonrpclib.history import History
-history = History.instance()
-from jsonrpclib.jsonrpc import Server, MultiCall, Fault
-from jsonrpclib.jsonrpc import ProtocolError, loads, dumps
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py
deleted file mode 100755
index 4d28f1b1..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import sys
-
-class LocalClasses(dict):
- def add(self, cls):
- self[cls.__name__] = cls
-
-class Config(object):
- """
- This is pretty much used exclusively for the 'jsonclass'
- functionality... set use_jsonclass to False to turn it off.
- You can change serialize_method and ignore_attribute, or use
- the local_classes.add(class) to include "local" classes.
- """
- use_jsonclass = True
- # Change to False to keep __jsonclass__ entries raw.
- serialize_method = '_serialize'
- # The serialize_method should be a string that references the
- # method on a custom class object which is responsible for
- # returning a tuple of the constructor arguments and a dict of
- # attributes.
- ignore_attribute = '_ignore'
- # The ignore attribute should be a string that references the
- # attribute on a custom class object which holds strings and / or
- # references of the attributes the class translator should ignore.
- classes = LocalClasses()
- # The list of classes to use for jsonclass translation.
- version = 2.0
- # Version of the JSON-RPC spec to support
- user_agent = 'jsonrpclib/0.1 (Python %s)' % \
- '.'.join([str(ver) for ver in sys.version_info[0:3]])
- # User agent to use for calls.
- _instance = None
-
- @classmethod
- def instance(cls):
- if not cls._instance:
- cls._instance = cls()
- return cls._instance
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/history.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/history.py
deleted file mode 100755
index d11863dc..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/history.py
+++ /dev/null
@@ -1,40 +0,0 @@
-class History(object):
- """
- This holds all the response and request objects for a
- session. A server using this should call "clear" after
- each request cycle in order to keep it from clogging
- memory.
- """
- requests = []
- responses = []
- _instance = None
-
- @classmethod
- def instance(cls):
- if not cls._instance:
- cls._instance = cls()
- return cls._instance
-
- def add_response(self, response_obj):
- self.responses.append(response_obj)
-
- def add_request(self, request_obj):
- self.requests.append(request_obj)
-
- @property
- def request(self):
- if len(self.requests) == 0:
- return None
- else:
- return self.requests[-1]
-
- @property
- def response(self):
- if len(self.responses) == 0:
- return None
- else:
- return self.responses[-1]
-
- def clear(self):
- del self.requests[:]
- del self.responses[:]
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonclass.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonclass.py
deleted file mode 100755
index 298c3da3..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonclass.py
+++ /dev/null
@@ -1,145 +0,0 @@
-import types
-import inspect
-import re
-import traceback
-
-from jsonrpclib import config
-
-iter_types = [
- types.DictType,
- types.ListType,
- types.TupleType
-]
-
-string_types = [
- types.StringType,
- types.UnicodeType
-]
-
-numeric_types = [
- types.IntType,
- types.LongType,
- types.FloatType
-]
-
-value_types = [
- types.BooleanType,
- types.NoneType
-]
-
-supported_types = iter_types+string_types+numeric_types+value_types
-invalid_module_chars = r'[^a-zA-Z0-9\_\.]'
-
-class TranslationError(Exception):
- pass
-
-def dump(obj, serialize_method=None, ignore_attribute=None, ignore=[]):
- if not serialize_method:
- serialize_method = config.serialize_method
- if not ignore_attribute:
- ignore_attribute = config.ignore_attribute
- obj_type = type(obj)
- # Parse / return default "types"...
- if obj_type in numeric_types+string_types+value_types:
- return obj
- if obj_type in iter_types:
- if obj_type in (types.ListType, types.TupleType):
- new_obj = []
- for item in obj:
- new_obj.append(dump(item, serialize_method,
- ignore_attribute, ignore))
- if obj_type is types.TupleType:
- new_obj = tuple(new_obj)
- return new_obj
- # It's a dict...
- else:
- new_obj = {}
- for key, value in obj.iteritems():
- new_obj[key] = dump(value, serialize_method,
- ignore_attribute, ignore)
- return new_obj
- # It's not a standard type, so it needs __jsonclass__
- module_name = inspect.getmodule(obj).__name__
- class_name = obj.__class__.__name__
- json_class = class_name
- if module_name not in ['', '__main__']:
- json_class = '%s.%s' % (module_name, json_class)
- return_obj = {"__jsonclass__":[json_class,]}
- # If a serialization method is defined..
- if serialize_method in dir(obj):
- # Params can be a dict (keyword) or list (positional)
- # Attrs MUST be a dict.
- serialize = getattr(obj, serialize_method)
- params, attrs = serialize()
- return_obj['__jsonclass__'].append(params)
- return_obj.update(attrs)
- return return_obj
- # Otherwise, try to figure it out
- # Obviously, we can't assume to know anything about the
- # parameters passed to __init__
- return_obj['__jsonclass__'].append([])
- attrs = {}
- ignore_list = getattr(obj, ignore_attribute, [])+ignore
- for attr_name, attr_value in obj.__dict__.iteritems():
- if type(attr_value) in supported_types and \
- attr_name not in ignore_list and \
- attr_value not in ignore_list:
- attrs[attr_name] = dump(attr_value, serialize_method,
- ignore_attribute, ignore)
- return_obj.update(attrs)
- return return_obj
-
-def load(obj):
- if type(obj) in string_types+numeric_types+value_types:
- return obj
- if type(obj) is types.ListType:
- return_list = []
- for entry in obj:
- return_list.append(load(entry))
- return return_list
- # Othewise, it's a dict type
- if '__jsonclass__' not in obj.keys():
- return_dict = {}
- for key, value in obj.iteritems():
- new_value = load(value)
- return_dict[key] = new_value
- return return_dict
- # It's a dict, and it's a __jsonclass__
- orig_module_name = obj['__jsonclass__'][0]
- params = obj['__jsonclass__'][1]
- if orig_module_name == '':
- raise TranslationError('Module name empty.')
- json_module_clean = re.sub(invalid_module_chars, '', orig_module_name)
- if json_module_clean != orig_module_name:
- raise TranslationError('Module name %s has invalid characters.' %
- orig_module_name)
- json_module_parts = json_module_clean.split('.')
- json_class = None
- if len(json_module_parts) == 1:
- # Local class name -- probably means it won't work
- if json_module_parts[0] not in config.classes.keys():
- raise TranslationError('Unknown class or module %s.' %
- json_module_parts[0])
- json_class = config.classes[json_module_parts[0]]
- else:
- json_class_name = json_module_parts.pop()
- json_module_tree = '.'.join(json_module_parts)
- try:
- temp_module = __import__(json_module_tree)
- except ImportError:
- raise TranslationError('Could not import %s from module %s.' %
- (json_class_name, json_module_tree))
- json_class = getattr(temp_module, json_class_name)
- # Creating the object...
- new_obj = None
- if type(params) is types.ListType:
- new_obj = json_class(*params)
- elif type(params) is types.DictType:
- new_obj = json_class(**params)
- else:
- raise TranslationError('Constructor args must be a dict or list.')
- for key, value in obj.iteritems():
- if key == '__jsonclass__':
- continue
- setattr(new_obj, key, value)
- return new_obj
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonrpc.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonrpc.py
deleted file mode 100755
index e11939ae..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/jsonrpc.py
+++ /dev/null
@@ -1,556 +0,0 @@
-"""
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-============================
-JSONRPC Library (jsonrpclib)
-============================
-
-This library is a JSON-RPC v.2 (proposed) implementation which
-follows the xmlrpclib API for portability between clients. It
-uses the same Server / ServerProxy, loads, dumps, etc. syntax,
-while providing features not present in XML-RPC like:
-
-* Keyword arguments
-* Notifications
-* Versioning
-* Batches and batch notifications
-
-Eventually, I'll add a SimpleXMLRPCServer compatible library,
-and other things to tie the thing off nicely. :)
-
-For a quick-start, just open a console and type the following,
-replacing the server address, method, and parameters
-appropriately.
->>> import jsonrpclib
->>> server = jsonrpclib.Server('http://localhost:8181')
->>> server.add(5, 6)
-11
->>> server._notify.add(5, 6)
->>> batch = jsonrpclib.MultiCall(server)
->>> batch.add(3, 50)
->>> batch.add(2, 3)
->>> batch._notify.add(3, 5)
->>> batch()
-[53, 5]
-
-See http://code.google.com/p/jsonrpclib/ for more info.
-"""
-
-import types
-import sys
-from xmlrpclib import Transport as XMLTransport
-from xmlrpclib import SafeTransport as XMLSafeTransport
-from xmlrpclib import ServerProxy as XMLServerProxy
-from xmlrpclib import _Method as XML_Method
-import time
-import string
-import random
-
-# Library includes
-import jsonrpclib
-from jsonrpclib import config
-from jsonrpclib import history
-
-# JSON library importing
-cjson = None
-json = None
-try:
- import cjson
-except ImportError:
- try:
- import json
- except ImportError:
- try:
- import simplejson as json
- except ImportError:
- raise ImportError(
- 'You must have the cjson, json, or simplejson ' +
- 'module(s) available.'
- )
-
-IDCHARS = string.ascii_lowercase+string.digits
-
-class UnixSocketMissing(Exception):
- """
- Just a properly named Exception if Unix Sockets usage is
- attempted on a platform that doesn't support them (Windows)
- """
- pass
-
-#JSON Abstractions
-
-def jdumps(obj, encoding='utf-8'):
- # Do 'serialize' test at some point for other classes
- global cjson
- if cjson:
- return cjson.encode(obj)
- else:
- return json.dumps(obj, encoding=encoding)
-
-def jloads(json_string):
- global cjson
- if cjson:
- return cjson.decode(json_string)
- else:
- return json.loads(json_string)
-
-
-# XMLRPClib re-implementations
-
-class ProtocolError(Exception):
- pass
-
-class TransportMixIn(object):
- """ Just extends the XMLRPC transport where necessary. """
- user_agent = config.user_agent
- # for Python 2.7 support
- _connection = None
-
- def send_content(self, connection, request_body):
- connection.putheader("Content-Type", "application/json-rpc")
- connection.putheader("Content-Length", str(len(request_body)))
- connection.endheaders()
- if request_body:
- connection.send(request_body)
-
- def getparser(self):
- target = JSONTarget()
- return JSONParser(target), target
-
-class JSONParser(object):
- def __init__(self, target):
- self.target = target
-
- def feed(self, data):
- self.target.feed(data)
-
- def close(self):
- pass
-
-class JSONTarget(object):
- def __init__(self):
- self.data = []
-
- def feed(self, data):
- self.data.append(data)
-
- def close(self):
- return ''.join(self.data)
-
-class Transport(TransportMixIn, XMLTransport):
- pass
-
-class SafeTransport(TransportMixIn, XMLSafeTransport):
- pass
-from httplib import HTTP, HTTPConnection
-from socket import socket
-
-USE_UNIX_SOCKETS = False
-
-try:
- from socket import AF_UNIX, SOCK_STREAM
- USE_UNIX_SOCKETS = True
-except ImportError:
- pass
-
-if (USE_UNIX_SOCKETS):
-
- class UnixHTTPConnection(HTTPConnection):
- def connect(self):
- self.sock = socket(AF_UNIX, SOCK_STREAM)
- self.sock.connect(self.host)
-
- class UnixHTTP(HTTP):
- _connection_class = UnixHTTPConnection
-
- class UnixTransport(TransportMixIn, XMLTransport):
- def make_connection(self, host):
- import httplib
- host, extra_headers, x509 = self.get_host_info(host)
- return UnixHTTP(host)
-
-
-class ServerProxy(XMLServerProxy):
- """
- Unfortunately, much more of this class has to be copied since
- so much of it does the serialization.
- """
-
- def __init__(self, uri, transport=None, encoding=None,
- verbose=0, version=None):
- import urllib
- if not version:
- version = config.version
- self.__version = version
- schema, uri = urllib.splittype(uri)
- if schema not in ('http', 'https', 'unix'):
- raise IOError('Unsupported JSON-RPC protocol.')
- if schema == 'unix':
- if not USE_UNIX_SOCKETS:
- # Don't like the "generic" Exception...
- raise UnixSocketMissing("Unix sockets not available.")
- self.__host = uri
- self.__handler = '/'
- else:
- self.__host, self.__handler = urllib.splithost(uri)
- if not self.__handler:
- # Not sure if this is in the JSON spec?
- #self.__handler = '/'
- self.__handler == '/'
- if transport is None:
- if schema == 'unix':
- transport = UnixTransport()
- elif schema == 'https':
- transport = SafeTransport()
- else:
- transport = Transport()
- self.__transport = transport
- self.__encoding = encoding
- self.__verbose = verbose
-
- def _request(self, methodname, params, rpcid=None):
- request = dumps(params, methodname, encoding=self.__encoding,
- rpcid=rpcid, version=self.__version)
- response = self._run_request(request)
- check_for_errors(response)
- return response['result']
-
- def _request_notify(self, methodname, params, rpcid=None):
- request = dumps(params, methodname, encoding=self.__encoding,
- rpcid=rpcid, version=self.__version, notify=True)
- response = self._run_request(request, notify=True)
- check_for_errors(response)
- return
-
- def _run_request(self, request, notify=None):
- history.add_request(request)
-
- response = self.__transport.request(
- self.__host,
- self.__handler,
- request,
- verbose=self.__verbose
- )
-
- # Here, the XMLRPC library translates a single list
- # response to the single value -- should we do the
- # same, and require a tuple / list to be passed to
- # the response object, or expect the Server to be
- # outputting the response appropriately?
-
- history.add_response(response)
- if not response:
- return None
- return_obj = loads(response)
- return return_obj
-
- def __getattr__(self, name):
- # Same as original, just with new _Method reference
- return _Method(self._request, name)
-
- @property
- def _notify(self):
- # Just like __getattr__, but with notify namespace.
- return _Notify(self._request_notify)
-
-
-class _Method(XML_Method):
-
- def __call__(self, *args, **kwargs):
- if len(args) > 0 and len(kwargs) > 0:
- raise ProtocolError('Cannot use both positional ' +
- 'and keyword arguments (according to JSON-RPC spec.)')
- if len(args) > 0:
- return self.__send(self.__name, args)
- else:
- return self.__send(self.__name, kwargs)
-
- def __getattr__(self, name):
- self.__name = '%s.%s' % (self.__name, name)
- return self
- # The old method returned a new instance, but this seemed wasteful.
- # The only thing that changes is the name.
- #return _Method(self.__send, "%s.%s" % (self.__name, name))
-
-class _Notify(object):
- def __init__(self, request):
- self._request = request
-
- def __getattr__(self, name):
- return _Method(self._request, name)
-
-# Batch implementation
-
-class MultiCallMethod(object):
-
- def __init__(self, method, notify=False):
- self.method = method
- self.params = []
- self.notify = notify
-
- def __call__(self, *args, **kwargs):
- if len(kwargs) > 0 and len(args) > 0:
- raise ProtocolError('JSON-RPC does not support both ' +
- 'positional and keyword arguments.')
- if len(kwargs) > 0:
- self.params = kwargs
- else:
- self.params = args
-
- def request(self, encoding=None, rpcid=None):
- return dumps(self.params, self.method, version=2.0,
- encoding=encoding, rpcid=rpcid, notify=self.notify)
-
- def __repr__(self):
- return '%s' % self.request()
-
- def __getattr__(self, method):
- new_method = '%s.%s' % (self.method, method)
- self.method = new_method
- return self
-
-class MultiCallNotify(object):
-
- def __init__(self, multicall):
- self.multicall = multicall
-
- def __getattr__(self, name):
- new_job = MultiCallMethod(name, notify=True)
- self.multicall._job_list.append(new_job)
- return new_job
-
-class MultiCallIterator(object):
-
- def __init__(self, results):
- self.results = results
-
- def __iter__(self):
- for i in range(0, len(self.results)):
- yield self[i]
- raise StopIteration
-
- def __getitem__(self, i):
- item = self.results[i]
- check_for_errors(item)
- return item['result']
-
- def __len__(self):
- return len(self.results)
-
-class MultiCall(object):
-
- def __init__(self, server):
- self._server = server
- self._job_list = []
-
- def _request(self):
- if len(self._job_list) < 1:
- # Should we alert? This /is/ pretty obvious.
- return
- request_body = '[ %s ]' % ','.join([job.request() for
- job in self._job_list])
- responses = self._server._run_request(request_body)
- del self._job_list[:]
- if not responses:
- responses = []
- return MultiCallIterator(responses)
-
- @property
- def _notify(self):
- return MultiCallNotify(self)
-
- def __getattr__(self, name):
- new_job = MultiCallMethod(name)
- self._job_list.append(new_job)
- return new_job
-
- __call__ = _request
-
-# These lines conform to xmlrpclib's "compatibility" line.
-# Not really sure if we should include these, but oh well.
-Server = ServerProxy
-
-class Fault(object):
- # JSON-RPC error class
- def __init__(self, code=-32000, message='Server error', rpcid=None):
- self.faultCode = code
- self.faultString = message
- self.rpcid = rpcid
-
- def error(self):
- return {'code':self.faultCode, 'message':self.faultString}
-
- def response(self, rpcid=None, version=None):
- if not version:
- version = config.version
- if rpcid:
- self.rpcid = rpcid
- return dumps(
- self, methodresponse=True, rpcid=self.rpcid, version=version
- )
-
- def __repr__(self):
- return '<Fault %s: %s>' % (self.faultCode, self.faultString)
-
-def random_id(length=8):
- return_id = ''
- for i in range(length):
- return_id += random.choice(IDCHARS)
- return return_id
-
-class Payload(dict):
- def __init__(self, rpcid=None, version=None):
- if not version:
- version = config.version
- self.id = rpcid
- self.version = float(version)
-
- def request(self, method, params=[]):
- if type(method) not in types.StringTypes:
- raise ValueError('Method name must be a string.')
- if not self.id:
- self.id = random_id()
- request = { 'id':self.id, 'method':method }
- if params:
- request['params'] = params
- if self.version >= 2:
- request['jsonrpc'] = str(self.version)
- return request
-
- def notify(self, method, params=[]):
- request = self.request(method, params)
- if self.version >= 2:
- del request['id']
- else:
- request['id'] = None
- return request
-
- def response(self, result=None):
- response = {'result':result, 'id':self.id}
- if self.version >= 2:
- response['jsonrpc'] = str(self.version)
- else:
- response['error'] = None
- return response
-
- def error(self, code=-32000, message='Server error.'):
- error = self.response()
- if self.version >= 2:
- del error['result']
- else:
- error['result'] = None
- error['error'] = {'code':code, 'message':message}
- return error
-
-def dumps(params=[], methodname=None, methodresponse=None,
- encoding=None, rpcid=None, version=None, notify=None):
- """
- This differs from the Python implementation in that it implements
- the rpcid argument since the 2.0 spec requires it for responses.
- """
- if not version:
- version = config.version
- valid_params = (types.TupleType, types.ListType, types.DictType)
- if methodname in types.StringTypes and \
- type(params) not in valid_params and \
- not isinstance(params, Fault):
- """
- If a method, and params are not in a listish or a Fault,
- error out.
- """
- raise TypeError('Params must be a dict, list, tuple or Fault ' +
- 'instance.')
- # Begin parsing object
- payload = Payload(rpcid=rpcid, version=version)
- if not encoding:
- encoding = 'utf-8'
- if type(params) is Fault:
- response = payload.error(params.faultCode, params.faultString)
- return jdumps(response, encoding=encoding)
- if type(methodname) not in types.StringTypes and methodresponse != True:
- raise ValueError('Method name must be a string, or methodresponse '+
- 'must be set to True.')
- if config.use_jsonclass == True:
- from jsonrpclib import jsonclass
- params = jsonclass.dump(params)
- if methodresponse is True:
- if rpcid is None:
- raise ValueError('A method response must have an rpcid.')
- response = payload.response(params)
- return jdumps(response, encoding=encoding)
- request = None
- if notify == True:
- request = payload.notify(methodname, params)
- else:
- request = payload.request(methodname, params)
- return jdumps(request, encoding=encoding)
-
-def loads(data):
- """
- This differs from the Python implementation, in that it returns
- the request structure in Dict format instead of the method, params.
- It will return a list in the case of a batch request / response.
- """
- if data == '':
- # notification
- return None
- result = jloads(data)
- # if the above raises an error, the implementing server code
- # should return something like the following:
- # { 'jsonrpc':'2.0', 'error': fault.error(), id: None }
- if config.use_jsonclass == True:
- from jsonrpclib import jsonclass
- result = jsonclass.load(result)
- return result
-
-def check_for_errors(result):
- if not result:
- # Notification
- return result
- if type(result) is not types.DictType:
- raise TypeError('Response is not a dict.')
- if 'jsonrpc' in result.keys() and float(result['jsonrpc']) > 2.0:
- raise NotImplementedError('JSON-RPC version not yet supported.')
- if 'result' not in result.keys() and 'error' not in result.keys():
- raise ValueError('Response does not have a result or error key.')
- if 'error' in result.keys() and result['error'] != None:
- code = result['error']['code']
- message = result['error']['message']
- raise ProtocolError((code, message))
- return result
-
-def isbatch(result):
- if type(result) not in (types.ListType, types.TupleType):
- return False
- if len(result) < 1:
- return False
- if type(result[0]) is not types.DictType:
- return False
- if 'jsonrpc' not in result[0].keys():
- return False
- try:
- version = float(result[0]['jsonrpc'])
- except ValueError:
- raise ProtocolError('"jsonrpc" key must be a float(able) value.')
- if version < 2:
- return False
- return True
-
-def isnotification(request):
- if 'id' not in request.keys():
- # 2.0 notification
- return True
- if request['id'] == None:
- # 1.0 notification
- return True
- return False
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/setup.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/setup.py
deleted file mode 100755
index 569b6367..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/setup.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env/python
-"""
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-"""
-
-import distutils.core
-
-distutils.core.setup(
- name = "jsonrpclib",
- version = "0.1.3",
- packages = ["jsonrpclib"],
- author = "Josh Marshall",
- author_email = "catchjosh@gmail.com",
- url = "http://github.com/joshmarshall/jsonrpclib/",
- license = "http://www.apache.org/licenses/LICENSE-2.0",
- description = "This project is an implementation of the JSON-RPC v2.0 " +
- "specification (backwards-compatible) as a client library.",
-)
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/LICENSE.txt b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/LICENSE.txt
deleted file mode 100755
index eb0864bd..00000000
--- a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-pelix-0.2.5/LICENSE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/rednose.py b/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/rednose.py
deleted file mode 100755
index 1ff892ad..00000000
--- a/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/rednose.py
+++ /dev/null
@@ -1,387 +0,0 @@
-# Copyright (c) 2009, Tim Cuthbertson # All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-# * Neither the name of the organisation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from __future__ import print_function
-import os
-import sys
-import linecache
-import re
-import time
-
-import nose
-
-import termstyle
-
-failure = 'FAILED'
-error = 'ERROR'
-success = 'passed'
-skip = 'skipped'
-line_length = 77
-
-PY3 = sys.version_info[0] >= 3
-if PY3:
- to_unicode = str
-else:
- def to_unicode(s):
- try:
- return unicode(s)
- except UnicodeDecodeError:
- return unicode(repr(str(s)))
-
-BLACKLISTED_WRITERS = [
- 'nose[\\/]result\\.pyc?$',
- 'unittest[\\/]runner\\.pyc?$'
-]
-REDNOSE_DEBUG = False
-
-
-class RedNose(nose.plugins.Plugin):
- env_opt = 'NOSE_REDNOSE'
- env_opt_color = 'NOSE_REDNOSE_COLOR'
- score = 199 # just under the `coverage` module
-
- def __init__(self, *args):
- super(RedNose, self).__init__(*args)
- self.reports = []
- self.error = self.success = self.failure = self.skip = 0
- self.total = 0
- self.stream = None
- self.verbose = False
- self.enabled = False
- self.tree = False
-
- def options(self, parser, env=os.environ):
- global REDNOSE_DEBUG
- rednose_on = bool(env.get(self.env_opt, False))
- rednose_color = env.get(self.env_opt_color, 'auto')
- REDNOSE_DEBUG = bool(env.get('REDNOSE_DEBUG', False))
-
- parser.add_option(
- "--rednose",
- action="store_true",
- default=rednose_on,
- dest="rednose",
- help="enable colour output (alternatively, set $%s=1)" % (self.env_opt,)
- )
- parser.add_option(
- "--no-color",
- action="store_false",
- dest="rednose",
- help="disable colour output"
- )
- parser.add_option(
- "--force-color",
- action="store_const",
- dest='rednose_color',
- default=rednose_color,
- const='force',
- help="force colour output when not using a TTY (alternatively, set $%s=force)" % (self.env_opt_color,)
- )
- parser.add_option(
- "--immediate",
- action="store_true",
- default=False,
- help="print errors and failures as they happen, as well as at the end"
- )
-
- def configure(self, options, conf):
- if options.rednose:
- self.enabled = True
- termstyle_init = {
- 'force': termstyle.enable,
- 'off': termstyle.disable
- }.get(options.rednose_color, termstyle.auto)
- termstyle_init()
-
- self.immediate = options.immediate
- self.verbose = options.verbosity >= 2
-
- def begin(self):
- self.start_time = time.time()
- self._in_test = False
-
- def _format_test_name(self, test):
- return test.shortDescription() or to_unicode(test)
-
- def prepareTestResult(self, result):
- result.stream = FilteringStream(self.stream, BLACKLISTED_WRITERS)
-
- def beforeTest(self, test):
- self._in_test = True
- if self.verbose:
- self._out(self._format_test_name(test) + ' ... ')
-
- def afterTest(self, test):
- if self._in_test:
- self.addSkip()
-
- def _print_test(self, type_, color):
- self.total += 1
- if self.verbose:
- self._outln(color(type_))
- else:
- if type_ == failure:
- short_ = 'F'
- elif type_ == error:
- short_ = 'X'
- elif type_ == skip:
- short_ = '-'
- else:
- short_ = '.'
- self._out(color(short_))
- if self.total % line_length == 0:
- self._outln()
- self._in_test = False
-
- def _add_report(self, report):
- failure_type, test, err = report
- self.reports.append(report)
- if self.immediate:
- self._outln()
- self._report_test(len(self.reports), *report)
-
- def addFailure(self, test, err):
- self.failure += 1
- self._add_report((failure, test, err))
- self._print_test(failure, termstyle.red)
-
- def addError(self, test, err):
- if err[0].__name__ == 'SkipTest':
- self.addSkip(test, err)
- return
- self.error += 1
- self._add_report((error, test, err))
- self._print_test(error, termstyle.yellow)
-
- def addSuccess(self, test):
- self.success += 1
- self._print_test(success, termstyle.green)
-
- def addSkip(self, test=None, err=None):
- self.skip += 1
- self._print_test(skip, termstyle.blue)
-
- def setOutputStream(self, stream):
- self.stream = stream
-
- def report(self, stream):
- """report on all registered failures and errors"""
- self._outln()
- if self.immediate:
- for x in range(0, 5):
- self._outln()
- report_num = 0
- if len(self.reports) > 0:
- for report_num, report in enumerate(self.reports):
- self._report_test(report_num + 1, *report)
- self._outln()
-
- self._summarize()
-
- def _summarize(self):
- """summarize all tests - the number of failures, errors and successes"""
- self._line(termstyle.black)
- self._out("%s test%s run in %0.1f seconds" % (
- self.total,
- self._plural(self.total),
- time.time() - self.start_time))
- if self.total > self.success:
- self._outln(". ")
- additionals = []
- if self.failure > 0:
- additionals.append(termstyle.red("%s FAILED" % (
- self.failure,)))
- if self.error > 0:
- additionals.append(termstyle.yellow("%s error%s" % (
- self.error,
- self._plural(self.error) )))
- if self.skip > 0:
- additionals.append(termstyle.blue("%s skipped" % (
- self.skip)))
- self._out(', '.join(additionals))
-
- self._out(termstyle.green(" (%s test%s passed)" % (
- self.success,
- self._plural(self.success) )))
- self._outln()
-
- def _report_test(self, report_num, type_, test, err):
- """report the results of a single (failing or errored) test"""
- self._line(termstyle.black)
- self._out("%s) " % (report_num))
- if type_ == failure:
- color = termstyle.red
- self._outln(color('FAIL: %s' % (self._format_test_name(test),)))
- else:
- color = termstyle.yellow
- self._outln(color('ERROR: %s' % (self._format_test_name(test),)))
-
- exc_type, exc_instance, exc_trace = err
-
- self._outln()
- self._outln(self._fmt_traceback(exc_trace))
- self._out(color(' ', termstyle.bold(color(exc_type.__name__)), ": "))
- self._outln(self._fmt_message(exc_instance, color))
- self._outln()
-
- def _relative_path(self, path):
- """
- If path is a child of the current working directory, the relative
- path is returned surrounded by bold xterm escape sequences.
- If path is not a child of the working directory, path is returned
- """
- try:
- here = os.path.abspath(os.path.realpath(os.getcwd()))
- fullpath = os.path.abspath(os.path.realpath(path))
- except OSError:
- return path
- if fullpath.startswith(here):
- return termstyle.bold(fullpath[len(here)+1:])
- return path
-
- def _file_line(self, tb):
- """formats the file / lineno / function line of a traceback element"""
- prefix = "file://"
- prefix = ""
-
- f = tb.tb_frame
- if '__unittest' in f.f_globals:
- # this is the magical flag that prevents unittest internal
- # code from junking up the stacktrace
- return None
-
- filename = f.f_code.co_filename
- lineno = tb.tb_lineno
- linecache.checkcache(filename)
- function_name = f.f_code.co_name
-
- line_contents = linecache.getline(filename, lineno, f.f_globals).strip()
-
- return " %s line %s in %s\n %s" % (
- termstyle.blue(prefix, self._relative_path(filename)),
- lineno,
- termstyle.cyan(function_name),
- line_contents)
-
- def _fmt_traceback(self, trace):
- """format a traceback"""
- ret = []
- ret.append(termstyle.default(" Traceback (most recent call last):"))
- current_trace = trace
- while current_trace is not None:
- line = self._file_line(current_trace)
- if line is not None:
- ret.append(line)
- current_trace = current_trace.tb_next
- return '\n'.join(ret)
-
- def _fmt_message(self, exception, color):
- orig_message_lines = to_unicode(exception).splitlines()
-
- if len(orig_message_lines) == 0:
- return ''
- message_lines = [color(orig_message_lines[0])]
- for line in orig_message_lines[1:]:
- match = re.match('^---.* begin captured stdout.*----$', line)
- if match:
- color = None
- message_lines.append('')
- line = ' ' + line
- message_lines.append(color(line) if color is not None else line)
- return '\n'.join(message_lines)
-
- def _out(self, msg='', newline=False):
- self.stream.write(msg)
- if newline:
- self.stream.write('\n')
-
- def _outln(self, msg=''):
- self._out(msg, True)
-
- def _plural(self, num):
- return '' if num == 1 else 's'
-
- def _line(self, color=termstyle.reset, char='-'):
- """
- print a line of separator characters (default '-')
- in the given colour (default black)
- """
- self._outln(color(char * line_length))
-
-
-import traceback
-import sys
-
-
-class FilteringStream(object):
- """
- A wrapper for a stream that will filter
- calls to `write` and `writeln` to ignore calls
- from blacklisted callers
- (implemented as a regex on their filename, according
- to traceback.extract_stack())
-
- It's super hacky, but there seems to be no other way
- to suppress nose's default output
- """
- def __init__(self, stream, excludes):
- self.__stream = stream
- self.__excludes = list(map(re.compile, excludes))
-
- def __should_filter(self):
- try:
- stack = traceback.extract_stack(limit=3)[0]
- filename = stack[0]
- pattern_matches_filename = lambda pattern: pattern.search(filename)
- should_filter = any(map(pattern_matches_filename, self.__excludes))
- if REDNOSE_DEBUG:
- print >> sys.stderr, "REDNOSE_DEBUG: got write call from %s, should_filter = %s" % (
- filename, should_filter)
- return should_filter
- except StandardError as e:
- if REDNOSE_DEBUG:
- print("\nError in rednose filtering: %s" % (e,), file=sys.stderr)
- traceback.print_exc(sys.stderr)
- return False
-
- def write(self, *a):
- if self.__should_filter():
- return
- return self.__stream.write(*a)
-
- def writeln(self, *a):
- if self.__should_filter():
- return
- return self.__stream.writeln(*a)
-
- # pass non-known methods through to self.__stream
- def __getattr__(self, name):
- if REDNOSE_DEBUG:
- print("REDNOSE_DEBUG: getting attr %s" % (name,), file=sys.stderr)
- return getattr(self.__stream, name)
diff --git a/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/setup.py b/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/setup.py
deleted file mode 100755
index 34cded4b..00000000
--- a/scripts/automation/trex_control_plane/python_lib/rednose-0.4.1/setup.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-## NOTE: ##
-## this setup.py was generated by zero2pypi:
-## http://gfxmonk.net/dist/0install/zero2pypi.xml
-
-from setuptools import *
-setup(
- packages = find_packages(exclude=['test', 'test.*']),
- description='coloured output for nosetests',
- entry_points={'nose.plugins.0.10': ['NOSETESTS_PLUGINS = rednose:RedNose']},
- install_requires=['setuptools', 'python-termstyle >=0.1.7'],
- long_description="\n**Note**: This package has been built automatically by\n`zero2pypi <http://gfxmonk.net/dist/0install/zero2pypi.xml>`_.\nIf possible, you should use the zero-install feed instead:\nhttp://gfxmonk.net/dist/0install/rednose.xml\n\n----------------\n\n=========\nrednose\n=========\n\nrednose is a `nosetests`_\nplugin for adding colour (and readability) to nosetest console results.\n\nInstallation:\n-------------\n::\n\n\teasy_install rednose\n\t\nor from the source::\n\n\t./setup.py develop\n\nUsage:\n------\n::\n\n\tnosetests --rednose\n\nor::\n\n\texport NOSE_REDNOSE=1\n\tnosetests\n\nRednose by default uses auto-colouring, which will only use\ncolour if you're running it on a terminal (i.e not piping it\nto a file). To control colouring, use one of::\n\n\tnosetests --rednose --force-color\n\tnosetests --no-color\n\n(you can also control this by setting the environment variable NOSE_REDNOSE_COLOR to 'force' or 'no')\n\n.. _nosetests: http://somethingaboutorange.com/mrl/projects/nose/\n",
- name='rednose',
- py_modules=['rednose'],
- url='http://gfxmonk.net/dist/0install/rednose.xml',
- version='0.4.1',
-classifiers=[
- "License :: OSI Approved :: BSD License",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3",
- "Development Status :: 4 - Beta",
- "Intended Audience :: Developers",
- "Topic :: Software Development :: Libraries :: Python Modules",
- "Topic :: Software Development :: Testing",
- ],
- keywords='test nosetests nose nosetest output colour console',
- license='BSD',
-)
diff --git a/scripts/automation/trex_control_plane/python_lib/zmq_fedora.tar.gz b/scripts/automation/trex_control_plane/python_lib/zmq_fedora.tar.gz
deleted file mode 100755
index 4f36749b..00000000
--- a/scripts/automation/trex_control_plane/python_lib/zmq_fedora.tar.gz
+++ /dev/null
Binary files differ
diff --git a/scripts/automation/trex_control_plane/server/outer_packages.py b/scripts/automation/trex_control_plane/server/outer_packages.py
index ab25ea68..218ac22a 100755
--- a/scripts/automation/trex_control_plane/server/outer_packages.py
+++ b/scripts/automation/trex_control_plane/server/outer_packages.py
@@ -1,66 +1,34 @@
#!/router/bin/python
-import sys,site
-import platform,os
-import tarfile
-import errno
-import pwd
+import sys
+import site
+import os
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory
PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, 'python_lib'))
SERVER_MODULES = ['enum34-1.0.4',
- # 'jsonrpclib-0.1.3',
- 'jsonrpclib-pelix-0.2.5',
- 'zmq',
- 'python-daemon-2.0.5',
- 'lockfile-0.10.2',
- 'termstyle'
- ]
+ 'jsonrpclib-pelix-0.2.5',
+ 'zmq',
+ 'python-daemon-2.0.5',
+ 'lockfile-0.10.2',
+ 'termstyle'
+ ]
-def extract_zmq_package ():
- """make sure zmq package is available"""
- os.chdir(PATH_TO_PYTHON_LIB)
- if not os.path.exists('zmq'):
- if os.path.exists('zmq_fedora.tar.gz'): # make sure tar file is available for extraction
- try:
- tar = tarfile.open("zmq_fedora.tar.gz")
- # finally, extract the tarfile locally
- tar.extractall()
- except OSError as err:
- if err.errno == errno.EACCES:
- # fall back. try extracting using currently logged in user
- stat_info = os.stat(PATH_TO_PYTHON_LIB)
- uid = stat_info.st_uid
- logged_user = pwd.getpwuid(uid).pw_name
- if logged_user != 'root':
- try:
- os.system("sudo -u {user} tar -zxvf zmq_fedora.tar.gz".format(user = logged_user))
- except:
- raise OSError(13, 'Permission denied: Please make sure that logged user have sudo access and writing privileges to `python_lib` directory.')
- else:
- raise OSError(13, 'Permission denied: Please make sure that logged user have sudo access and writing privileges to `python_lib` directory.')
- finally:
- tar.close()
- else:
- raise IOError("File 'zmq_fedora.tar.gz' couldn't be located at python_lib directory.")
- os.chdir(CURRENT_PATH)
-
-def import_server_modules ():
+def import_server_modules():
# must be in a higher priority
sys.path.insert(0, PATH_TO_PYTHON_LIB)
sys.path.append(ROOT_PATH)
- extract_zmq_package()
import_module_list(SERVER_MODULES)
+
def import_module_list (modules_list):
assert(isinstance(modules_list, list))
for p in modules_list:
- full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
- fix_path = os.path.normcase(full_path)
+ full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
+ fix_path = os.path.normcase(full_path)
site.addsitedir(full_path)
-
import_server_modules()