fix unittests, mock trex_stl_lib, fix raw_input, division 09/28209/10
authorRoss Brattain <ross.b.brattain@intel.com>
Tue, 7 Feb 2017 10:17:43 +0000 (02:17 -0800)
committerRoss Brattain <ross.b.brattain@intel.com>
Wed, 8 Feb 2017 02:42:26 +0000 (18:42 -0800)
commit2f5534e1ba3b9a471ab98a7b35ac5f6a0832a9a7
tree11563ce8cd9c4b8a3b5fde6f88655e57e08489fc
parent6871f03787d1161d086434d929f4dec6b352c265
fix unittests, mock trex_stl_lib, fix raw_input, division

replace raw_input with six.moves.raw_input
fix raw_input mock
force float division in python 2

re-added trex download to try to workaround coverage failing
try installing pyzmq=14.5.0 and see if that helps trex compatibility

======================================================================
ERROR: test__fill_traffic_profile (benchmark.scenarios.networking.test_vnf_generic.TestNetworkServiceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py", line 399, in test__fill_traffic_profile
    self.context_cfg))
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/benchmark/scenarios/networking/vnf_generic.py", line 144, in _fill_traffic_profile
    return TrafficProfile.get(traffic_profile)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/network_services/traffic_profile/base.py", line 35, in get
    "yardstick.network_services.traffic_profile")
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/common/utils.py", line 86, in import_modules_from_package
    try_append_module(module_name, sys.modules)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/common/utils.py", line 70, in try_append_module
    modules[name] = importutils.import_module(name)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/oslo_utils/importutils.py", line 73, in import_module
    __import__(import_str)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/network_services/traffic_profile/rfc2544.py", line 19, in <module>
    from yardstick.network_services.traffic_profile.traffic_profile \
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/yardstick/network_services/traffic_profile/traffic_profile.py", line 24, in <module>
    from stl.trex_stl_lib.trex_stl_client import STLStream
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py", line 7, in <module>
    from .trex_stl_jsonrpc_client import JsonRpcClient, BatchMessage
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py", line 3, in <module>
    import zmq
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/__init__.py", line 49, in <module>
    from zmq import backend
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/__init__.py", line 41, in <module>
    reraise(*exc_info)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/utils/sixcerpt.py", line 34, in reraise
    raise value
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/__init__.py", line 29, in <module>
    _ns = select_backend(first)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/select.py", line 27, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/cython/__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: cannot import name 'constants'

======================================================================
ERROR: network_services.vnf_generic.vnf.test_tg_trex (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: network_services.vnf_generic.vnf.test_tg_trex
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py", line 24, in <module>
    from stl.trex_stl_lib.trex_stl_client import STLClient
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py", line 7, in <module>
    from .trex_stl_jsonrpc_client import JsonRpcClient, BatchMessage
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py", line 3, in <module>
    import zmq
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/__init__.py", line 49, in <module>
    from zmq import backend
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/__init__.py", line 41, in <module>
    reraise(*exc_info)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/utils/sixcerpt.py", line 34, in reraise
    raise value
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/__init__.py", line 29, in <module>
    _ns = select_backend(first)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/select.py", line 27, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/trex/scripts/external_libs/pyzmq-14.5.0/python3/fedora18/64bit/zmq/backend/cython/__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: cannot import name 'constants'

Change-Id: I832bf8c912dea6d85131ee6603b408b3198cef2f
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
requirements.txt
run_tests.sh
tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
tests/unit/cmd/test_NSBperf.py
tests/unit/network_services/traffic_profile/test_fixed.py
tests/unit/network_services/traffic_profile/test_rfc2544.py
tests/unit/network_services/traffic_profile/test_traffic_profile.py
tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
yardstick/cmd/NSBperf.py
yardstick/network_services/traffic_profile/rfc2544.py