summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-02-02 11:57:17 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-02-02 14:26:33 +0200
commitcfcbe7a0d5085af3d5fe1c9127b9237fa66408b2 (patch)
tree9ffa28bd77dc6e43aaed1ee2f93d48f2ffaf9bb8 /scripts/automation/trex_control_plane
parent781d71db20b0c5acbe940eff1b1ef2f1b765ce54 (diff)
fixed missing .so files due to ignored by .gitignore + fixed path
Change-Id: If014548f3d007f9eda6d54332ac04952ea91f751 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r--scripts/automation/trex_control_plane/client_utils/external_packages.py56
-rwxr-xr-xscripts/automation/trex_control_plane/examples/zmq_server_client.py12
-rwxr-xr-xscripts/automation/trex_control_plane/server/outer_packages.py17
-rw-r--r--scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_client.py12
4 files changed, 44 insertions, 53 deletions
diff --git a/scripts/automation/trex_control_plane/client_utils/external_packages.py b/scripts/automation/trex_control_plane/client_utils/external_packages.py
index c682dc18..049cc59c 100644
--- a/scripts/automation/trex_control_plane/client_utils/external_packages.py
+++ b/scripts/automation/trex_control_plane/client_utils/external_packages.py
@@ -4,22 +4,33 @@ import sys
import os
import warnings
+python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
+
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, os.pardir, os.pardir, 'external_libs'))
+ZMQ_PATH = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))
CLIENT_UTILS_MODULES = ['dpkt-1.8.6',
'yaml-3.11',
'texttable-0.8.4',
'scapy-2.3.1'
+ 'zmq',
]
def import_client_utils_modules():
# must be in a higher priority
- sys.path.insert(0, PATH_TO_PYTHON_LIB)
+ if PATH_TO_PYTHON_LIB not in sys.path:
+ sys.path.insert(0, PATH_TO_PYTHON_LIB)
+
+ if ROOT_PATH not in sys.path:
+ sys.path.append(ROOT_PATH)
+
+ if ZMQ_PATH not in sys.path:
+ sys.path.append(ZMQ_PATH)
- sys.path.append(ROOT_PATH)
import_module_list(CLIENT_UTILS_MODULES)
@@ -28,45 +39,8 @@ def import_module_list(modules_list):
for p in modules_list:
full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
fix_path = os.path.normcase(full_path)
- sys.path.insert(1, full_path)
-
-
- import_platform_dirs()
-
-
-
-def import_platform_dirs ():
- # handle platform dirs
-
- # try fedora 18 first and then cel5.9
- # we are using the ZMQ module to determine the right platform
-
- full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/fedora18')
- fix_path = os.path.normcase(full_path)
- sys.path.insert(0, full_path)
- try:
- # try to import and delete it from the namespace
- import zmq
- del zmq
- return
- except:
- sys.path.pop(0)
- pass
-
- full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/cel59')
- fix_path = os.path.normcase(full_path)
- sys.path.insert(0, full_path)
- try:
- # try to import and delete it from the namespace
- import zmq
- del zmq
- return
-
- except:
- sys.path.pop(0)
- sys.modules['zmq'] = None
- warnings.warn("unable to determine platform type for ZMQ import")
+ if full_path not in sys.path:
+ sys.path.insert(1, full_path)
-
import_client_utils_modules()
diff --git a/scripts/automation/trex_control_plane/examples/zmq_server_client.py b/scripts/automation/trex_control_plane/examples/zmq_server_client.py
index 15f37f1a..cbe136d0 100755
--- a/scripts/automation/trex_control_plane/examples/zmq_server_client.py
+++ b/scripts/automation/trex_control_plane/examples/zmq_server_client.py
@@ -1,8 +1,14 @@
import sys
import os
-python2_zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,
- 'external_libs','pyzmq-14.5.0','python2','fedora18','64bit'))
-sys.path.append(python2_zmq_path)
+
+python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
+
+zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,
+ 'external_libs','pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))
+if zmq_path not in sys.path:
+ sys.path.append(zmq_path)
+
import zmq
import json
from argparse import *
diff --git a/scripts/automation/trex_control_plane/server/outer_packages.py b/scripts/automation/trex_control_plane/server/outer_packages.py
index f49a9925..c21c8cbd 100755
--- a/scripts/automation/trex_control_plane/server/outer_packages.py
+++ b/scripts/automation/trex_control_plane/server/outer_packages.py
@@ -3,11 +3,12 @@
import sys
import os
python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
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, os.pardir, os.pardir, 'external_libs'))
-PATH_TO_PLATFORM_LIB = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver , 'fedora18', '64bit'))
+ZMQ_PATH = os.path.abspath(os.path.join(PATH_TO_PYTHON_LIB, 'pyzmq-14.5.0', python_ver, ucs_ver, '64bit'))
SERVER_MODULES = ['enum34-1.0.4',
'zmq',
@@ -19,10 +20,13 @@ SERVER_MODULES = ['enum34-1.0.4',
def import_server_modules():
- # must be in a higher priority
- sys.path.insert(0, PATH_TO_PYTHON_LIB)
- sys.path.insert(0, PATH_TO_PLATFORM_LIB)
- sys.path.append(ROOT_PATH)
+ # must be in a higher priority
+ if PATH_TO_PYTHON_LIB not in sys.path:
+ sys.path.insert(0, PATH_TO_PYTHON_LIB)
+ if ZMQ_PATH not in sys.path:
+ sys.path.insert(0, ZMQ_PATH)
+ if ROOT_PATH not in sys.path:
+ sys.path.append(ROOT_PATH)
import_module_list(SERVER_MODULES)
@@ -31,7 +35,8 @@ def import_module_list(modules_list):
for p in modules_list:
full_path = os.path.join(PATH_TO_PYTHON_LIB, p)
fix_path = os.path.normcase(full_path)
- sys.path.insert(1, full_path)
+ if full_path not in sys.path:
+ sys.path.insert(1, full_path)
import_server_modules()
diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_client.py b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_client.py
index 18d32272..5c23a1a8 100644
--- a/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_client.py
+++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/scapy_zmq_client.py
@@ -1,9 +1,15 @@
import sys
import os
-python2_zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,os.pardir,
- os.pardir,'external_libs','pyzmq-14.5.0','python2','fedora18','64bit'))
-sys.path.append(python2_zmq_path)
+
+python_ver = 'python%s' % sys.version_info.major
+ucs_ver = 'ucs2' if sys.maxunicode == 65535 else 'ucs4'
+
+zmq_path = os.path.abspath(os.path.join(os.pardir,os.pardir,os.pardir,os.pardir,
+ os.pardir,'external_libs','pyzmq-14.5.0', python_ver, ucs_ver,'64bit'))
+
+if zmq_path not in sys.path:
+ sys.path.append(zmq_path)
import zmq
import json