diff options
author | fmenguy <francoisregis.menguy@orange.com> | 2019-02-20 11:50:01 +0100 |
---|---|---|
committer | fmenguy <francoisregis.menguy@orange.com> | 2019-02-28 14:40:55 +0100 |
commit | e1887dcf96c21e96f259a94f5e6835d45b27dfdf (patch) | |
tree | 56d23924684100324fa0a4f8700d2aa1a5a2bf5d | |
parent | 7d83fb2596b3128ba47a7ac1e263e6926a0befd3 (diff) |
NFVBENCH-124 Upgrade TRex to v2.533.1.0
Change-Id: I7781d7a76ec06162c56112e592a43bb5060ef8b1
Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
-rw-r--r-- | docker/Dockerfile | 9 | ||||
-rwxr-xr-x | nfvbench/traffic_client.py | 6 | ||||
-rw-r--r-- | nfvbench/traffic_gen/trex_gen.py (renamed from nfvbench/traffic_gen/trex.py) | 68 | ||||
-rw-r--r-- | test/mock_trex.py | 41 | ||||
-rw-r--r-- | test/test_chains.py | 2 |
5 files changed, 66 insertions, 60 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index cd59fa0..1980575 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ # docker file for creating a container that has nfvbench installed and ready to use FROM ubuntu:16.04 -ENV TREX_VER "v2.32" +ENV TREX_VER "v2.53" ENV VM_IMAGE_VER "0.6" RUN apt-get update && apt-get install -y \ @@ -21,8 +21,8 @@ RUN apt-get update && apt-get install -y \ && tar xzf $TREX_VER.tar.gz -C /opt/trex \ && rm -f /$TREX_VER.tar.gz \ && rm -f /opt/trex/$TREX_VER/trex_client_$TREX_VER.tar.gz \ - && cp -a /opt/trex/$TREX_VER/automation/trex_control_plane/stl/trex_stl_lib /usr/local/lib/python2.7/dist-packages/ \ - && rm -rf /opt/trex/$TREX_VER/automation/trex_control_plane/stl/trex_stl_lib \ + && cp -a /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex /usr/local/lib/python2.7/dist-packages/ \ + && rm -rf /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex \ && sed -i -e "s/2048 /512 /" -e "s/2048\"/512\"/" /opt/trex/$TREX_VER/trex-cfg \ && pip install -U pip pbr \ && hash -r pip \ @@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y \ && apt-get remove -y wget git \ && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* -ENV TREX_STL_EXT_PATH "/opt/trex/$TREX_VER/external_libs" +ENV TREX_EXT_LIBS "/opt/trex/$TREX_VER/external_libs" + ENTRYPOINT ["/nfvbench/docker/nfvbench-entrypoint.sh"] diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py index 58ae345..469b922 100755 --- a/nfvbench/traffic_client.py +++ b/nfvbench/traffic_client.py @@ -23,7 +23,7 @@ from attrdict import AttrDict import bitmath from netaddr import IPNetwork # pylint: disable=import-error -from trex_stl_lib.api import STLError +from trex.stl.api import STLError # pylint: enable=import-error from log import LOG @@ -499,8 +499,8 @@ class TrafficClient(object): def _get_generator(self): tool = self.tool.lower() if tool == 'trex': - from traffic_gen import trex - return trex.TRex(self) + from traffic_gen import trex_gen + return trex_gen.TRex(self) if tool == 'dummy': from traffic_gen import dummy return dummy.DummyTG(self) diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex_gen.py index 32aa576..10937de 100644 --- a/nfvbench/traffic_gen/trex.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -33,29 +33,29 @@ from traffic_utils import IMIX_L2_SIZES from traffic_utils import IMIX_RATIOS # pylint: disable=import-error -from trex_stl_lib.api import bind_layers -from trex_stl_lib.api import CTRexVmInsFixHwCs -from trex_stl_lib.api import Dot1Q -from trex_stl_lib.api import Ether -from trex_stl_lib.api import FlagsField -from trex_stl_lib.api import IP -from trex_stl_lib.api import Packet -from trex_stl_lib.api import STLClient -from trex_stl_lib.api import STLError -from trex_stl_lib.api import STLFlowLatencyStats -from trex_stl_lib.api import STLFlowStats -from trex_stl_lib.api import STLPktBuilder -from trex_stl_lib.api import STLScVmRaw -from trex_stl_lib.api import STLStream -from trex_stl_lib.api import STLTXCont -from trex_stl_lib.api import STLVmFixChecksumHw -from trex_stl_lib.api import STLVmFlowVar -from trex_stl_lib.api import STLVmFlowVarRepetableRandom -from trex_stl_lib.api import STLVmWrFlowVar -from trex_stl_lib.api import ThreeBytesField -from trex_stl_lib.api import UDP -from trex_stl_lib.api import XByteField -from trex_stl_lib.services.trex_stl_service_arp import STLServiceARP +from trex.common.services.trex_service_arp import ServiceARP +from trex.stl.api import bind_layers +from trex.stl.api import CTRexVmInsFixHwCs +from trex.stl.api import Dot1Q +from trex.stl.api import Ether +from trex.stl.api import FlagsField +from trex.stl.api import IP +from trex.stl.api import Packet +from trex.stl.api import STLClient +from trex.stl.api import STLError +from trex.stl.api import STLFlowLatencyStats +from trex.stl.api import STLFlowStats +from trex.stl.api import STLPktBuilder +from trex.stl.api import STLScVmRaw +from trex.stl.api import STLStream +from trex.stl.api import STLTXCont +from trex.stl.api import STLVmFixChecksumHw +from trex.stl.api import STLVmFlowVar +from trex.stl.api import STLVmFlowVarRepeatableRandom +from trex.stl.api import STLVmWrFlowVar +from trex.stl.api import ThreeBytesField +from trex.stl.api import UDP +from trex.stl.api import XByteField # pylint: enable=import-error @@ -306,14 +306,14 @@ class TRex(AbstractTrafficGenerator): pkt_base /= IP() / UDP(**udp_args) if stream_cfg['ip_addrs_step'] == 'random': - src_fv = STLVmFlowVarRepetableRandom( + src_fv = STLVmFlowVarRepeatableRandom( name="ip_src", min_value=stream_cfg['ip_src_addr'], max_value=stream_cfg['ip_src_addr_max'], size=4, seed=random.randint(0, 32767), limit=stream_cfg['ip_src_count']) - dst_fv = STLVmFlowVarRepetableRandom( + dst_fv = STLVmFlowVarRepeatableRandom( name="ip_dst", min_value=stream_cfg['ip_dst_addr'], max_value=stream_cfg['ip_dst_addr_max'], @@ -500,19 +500,19 @@ class TRex(AbstractTrafficGenerator): # the index in the list is the chain id if self.config.vxlan: arps = [ - STLServiceARP(ctx, - src_ip=device.vtep_src_ip, - dst_ip=device.vtep_dst_ip, - vlan=device.vtep_vlan) + ServiceARP(ctx, + src_ip=device.vtep_src_ip, + dst_ip=device.vtep_dst_ip, + vlan=device.vtep_vlan) for cfg in stream_configs ] else: arps = [ - STLServiceARP(ctx, - src_ip=cfg['ip_src_tg_gw'], - dst_ip=cfg['mac_discovery_gw'], - # will be None if no vlan tagging - vlan=cfg['vlan_tag']) + ServiceARP(ctx, + src_ip=cfg['ip_src_tg_gw'], + dst_ip=cfg['mac_discovery_gw'], + # will be None if no vlan tagging + vlan=cfg['vlan_tag']) for cfg in stream_configs ] diff --git a/test/mock_trex.py b/test/mock_trex.py index c4ce9d7..ed6b20e 100644 --- a/test/mock_trex.py +++ b/test/mock_trex.py @@ -17,26 +17,29 @@ import sys # Because trex_stl_lib may not be installed when running unit test # nfvbench.traffic_client will try to import STLError: -# from trex_stl_lib.api import STLError -# will raise ImportError: No module named trex_stl_lib.api -# trex.py will also try to import a number of trex_stl_lib classes +# from trex.stl.api import STLError +# will raise ImportError: No module named trex.stl.api +# trex_gen.py will also try to import a number of trex.stl.api classes try: - import trex_stl_lib.api - assert trex_stl_lib.api + import trex.stl.api + assert trex.stl.api except ImportError: from types import ModuleType - # Make up a trex_stl_lib.api.STLError class + # Make up a trex.stl.api.STLError class class STLDummy(Exception): """Dummy class.""" pass - stl_lib_mod = ModuleType('trex_stl_lib') - sys.modules['trex_stl_lib'] = stl_lib_mod - api_mod = ModuleType('trex_stl_lib.api') + trex_lib_mod = ModuleType('trex') + sys.modules['trex'] = trex_lib_mod + stl_lib_mod = ModuleType('trex.stl') + trex_lib_mod.stl = stl_lib_mod + sys.modules['trex.stl'] = stl_lib_mod + api_mod = ModuleType('trex.stl.api') stl_lib_mod.api = api_mod - sys.modules['trex_stl_lib.api'] = api_mod + sys.modules['trex.stl.api'] = api_mod api_mod.STLError = STLDummy api_mod.STLxyz = STLDummy api_mod.CTRexVmInsFixHwCs = STLDummy @@ -52,7 +55,7 @@ except ImportError: api_mod.STLTXCont = STLDummy api_mod.STLVmFixChecksumHw = STLDummy api_mod.STLVmFlowVar = STLDummy - api_mod.STLVmFlowVarRepetableRandom = STLDummy + api_mod.STLVmFlowVarRepeatableRandom = STLDummy api_mod.STLVmWrFlowVar = STLDummy api_mod.UDP = STLDummy api_mod.bind_layers = STLDummy @@ -61,14 +64,16 @@ except ImportError: api_mod.ThreeBytesField = STLDummy api_mod.XByteField = STLDummy - services_mod = ModuleType('trex_stl_lib.services') - stl_lib_mod.services = services_mod - sys.modules['trex_stl_lib.services'] = services_mod - - arp_mod = ModuleType('trex_stl_lib.services.trex_stl_service_arp') + common_mod = ModuleType('trex.common') + trex_lib_mod.common = common_mod + sys.modules['trex.common'] = common_mod + services_mod = ModuleType('trex.common.services') + common_mod.services = services_mod + sys.modules['trex.common.services'] = services_mod + arp_mod = ModuleType('trex.common.services.trex_service_arp') services_mod.trex_stl_service_arp = arp_mod - sys.modules['trex_stl_lib.services.trex_stl_service_arp'] = arp_mod - arp_mod.STLServiceARP = STLDummy + sys.modules['trex.common.services.trex_service_arp'] = arp_mod + arp_mod.ServiceARP = STLDummy def no_op(): """Empty function.""" diff --git a/test/test_chains.py b/test/test_chains.py index 812aece..f4b792a 100644 --- a/test/test_chains.py +++ b/test/test_chains.py @@ -38,7 +38,7 @@ from nfvbench.specs import Specs from nfvbench.summarizer import _annotate_chain_stats from nfvbench.traffic_client import TrafficClient from nfvbench.traffic_gen.traffic_base import Latency -from nfvbench.traffic_gen.trex import TRex +from nfvbench.traffic_gen.trex_gen import TRex # just to get rid of the unused function warning |