diff options
-rw-r--r-- | docker/Dockerfile | 2 | ||||
-rw-r--r-- | nfvbench/traffic_gen/trex_gen.py | 12 | ||||
-rw-r--r-- | nfvbench/utils.py | 14 | ||||
-rw-r--r-- | test/mock_trex.py | 1 |
4 files changed, 18 insertions, 11 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 8cebd47..2ae8c83 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.61" +ENV TREX_VER "v2.79" ENV VM_IMAGE_VER "0.12" ENV PYTHONIOENCODING "utf8" diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py index 0ecad1e..de9500a 100644 --- a/nfvbench/traffic_gen/trex_gen.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -47,6 +47,7 @@ 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 STLVmFixIpv4 from trex.stl.api import STLVmFlowVar from trex.stl.api import STLVmFlowVarRepeatableRandom from trex.stl.api import STLVmWrFlowVar @@ -471,10 +472,13 @@ class TRex(AbstractTrafficGenerator): dst_fv_port, STLVmWrFlowVar(fv_name="p_dst", pkt_offset="UDP:{}.dport".format(encap_level)), ] - for encap in range(int(encap_level), -1, -1): - vm_param.append(STLVmFixChecksumHw(l3_offset="IP:{}".format(encap), - l4_offset="UDP:{}".format(encap), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP)) + # Use HW Offload to calculate the outter IP/UDP packet + vm_param.append(STLVmFixChecksumHw(l3_offset="IP:0", + l4_offset="UDP:0", + l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP)) + # Use software to fix the inner IP/UDP payload for VxLAN packets + if int(encap_level): + vm_param.append(STLVmFixIpv4(offset="IP:1")) pad = max(0, frame_size - len(pkt_base)) * 'x' return STLPktBuilder(pkt=pkt_base / pad, diff --git a/nfvbench/utils.py b/nfvbench/utils.py index 94cc11d..d4482fd 100644 --- a/nfvbench/utils.py +++ b/nfvbench/utils.py @@ -149,19 +149,21 @@ def get_intel_pci(nic_slot=None, nic_ports=None): continue matches.sort() + device_list = list(x[0].split('.')[0] for x in matches) + device_ports_list = {i: {'ports': device_list.count(i)} for i in device_list} for port in matches: intf_name = glob.glob("/sys/bus/pci/devices/%s/net/*" % port[0]) - if not intf_name: - # Interface is not bind to kernel driver, so take it - pcis.append(port[1]) - else: + if intf_name: intf_name = intf_name[0][intf_name[0].rfind('/') + 1:] process = subprocess.Popen(['ip', '-o', '-d', 'link', 'show', intf_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) intf_info, _ = process.communicate() - if not re.search('team_slave|bond_slave', intf_info.decode("utf-8")): - pcis.append(port[1]) + if re.search('team_slave|bond_slave', intf_info.decode("utf-8")): + device_ports_list[port[0].split('.')[0]]['busy'] = True + for port in matches: + if not device_ports_list[port[0].split('.')[0]].get('busy'): + pcis.append(port[1]) if len(pcis) == 2: break diff --git a/test/mock_trex.py b/test/mock_trex.py index 4f0271a..49fe5a9 100644 --- a/test/mock_trex.py +++ b/test/mock_trex.py @@ -52,6 +52,7 @@ except ImportError: api_mod.STLStream = STLDummy api_mod.STLTXCont = STLDummy api_mod.STLVmFixChecksumHw = STLDummy + api_mod.STLVmFixIpv4 = STLDummy api_mod.STLVmFlowVar = STLDummy api_mod.STLVmFlowVarRepeatableRandom = STLDummy api_mod.STLVmWrFlowVar = STLDummy |