aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/DPDK/L3fwdTest.py103
-rw-r--r--resources/libraries/python/TrafficGenerator.py19
-rw-r--r--resources/libraries/robot/DPDK/default.robot43
3 files changed, 164 insertions, 1 deletions
diff --git a/resources/libraries/python/DPDK/L3fwdTest.py b/resources/libraries/python/DPDK/L3fwdTest.py
new file mode 100644
index 0000000000..6219a08e0c
--- /dev/null
+++ b/resources/libraries/python/DPDK/L3fwdTest.py
@@ -0,0 +1,103 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# 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.
+
+
+"""
+This module exists to provide the l3fwd test for DPDK on topology nodes.
+"""
+
+from robot.api import logger
+
+from resources.libraries.python.ssh import SSH
+from resources.libraries.python.constants import Constants as con
+from resources.libraries.python.topology import Topology
+
+class L3fwdTest(object):
+ """Test the DPDK l3fwd performance."""
+
+ @staticmethod
+ def start_the_l3fwd_test(nodes_info, dut_node, dut_if1, dut_if2,
+ nb_cores, lcores_list, queue_nums, jumbo_frames):
+ """
+ Execute the l3fwd on the dut_node.
+
+ :param nodes_info: All the nodes info in the topology file.
+ :param dut_node: Will execute the l3fwd on this node
+ :param dut_if1: The test link interface 1.
+ :param dut_if2: The test link interface 2.
+ :param nb_cores: The cores number for the forwarding
+ :param lcores_list: The lcore list string for the l3fwd routing
+ :param queue_nums: The queues number for the NIC
+ :param jumbo_frames: Is jumbo frames or not. Accepted: yes / no
+ :type nodes_info: dict
+ :type dut_node: dict
+ :type dut_if1: str
+ :type dut_if2: str
+ :type nb_cores: str
+ :type lcores_list: str
+ :type queue_nums: str
+ :type jumbo_frames: str
+ :return: none
+ """
+
+ if_key0 = dut_if1
+ if_key1 = dut_if2
+ if_pci0 = Topology.get_interface_pci_addr(dut_node, if_key0)
+ if_pci1 = Topology.get_interface_pci_addr(dut_node, if_key1)
+
+ # detect which is the port 0
+ if min(if_pci0, if_pci1) != if_pci0:
+ if_key0, if_key1 = if_key1, if_key0
+ if_pci0, if_pci1 = if_pci1, if_pci0
+
+ adj_node0, adj_if_key0 = Topology.get_adjacent_node_and_interface( \
+ nodes_info, dut_node, if_key0)
+ adj_node1, adj_if_key1 = Topology.get_adjacent_node_and_interface( \
+ nodes_info, dut_node, if_key1)
+
+ adj_mac0 = Topology.get_interface_mac(adj_node0, adj_if_key0)
+ adj_mac1 = Topology.get_interface_mac(adj_node1, adj_if_key1)
+
+ list_cores = lcores_list.split(',')
+
+ # prepare the port config param
+ index = 0
+ port_config = ''
+ for port in range(0, 2):
+ for queue in range(0, int(queue_nums)):
+ if int(nb_cores) == 1:
+ index = 0
+ temp_str = '({0}, {1}, {2}),'.format(port, queue, \
+ int(list_cores[index]))
+ else:
+ temp_str = '({0}, {1}, {2}),'.format(port, queue, \
+ int(list_cores[index]))
+
+ port_config += temp_str
+ index = index + 1
+
+ port_config_param = port_config.rstrip(',')
+
+ ssh = SSH()
+ ssh.connect(dut_node)
+
+ cmd = 'cd {0}/dpdk-tests/dpdk_scripts/ && ./run_l3fwd.sh ' \
+ '"{1}" "{2}" {3} {4} {5}'.format(con.REMOTE_FW_DIR, lcores_list, \
+ port_config_param, adj_mac0, adj_mac1, jumbo_frames)
+
+ (ret_code, _, stderr) = ssh.exec_command(cmd, timeout=600)
+ if ret_code != 0:
+ logger.error('Execute the l3fwd error: {0}'.format(stderr))
+ raise Exception('Failed to execute l3fwd test at node {0}'
+ .format(dut_node['host']))
+
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index c9cd971cf3..8fb9191063 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -709,7 +709,24 @@ class TrafficGenerator(object):
duration, rate, framesize,
_p0, _p1, _async, _latency,
warmup_time),
- timeout=int(duration) + 60)
+ timeout = int(duration) + 60)
+ elif traffic_type in ["3-node-IPv4-l3fwd"]:
+ # add for the DPDK l3fwd routing test
+ # please make sure the TG port 0 connect to the DUT port 0
+ (ret, stdout, stderr) = ssh.exec_command(
+ "sh -c '{0}/resources/tools/t-rex/t-rex-stateless.py "
+ "--duration={1} -r {2} -s {3} "
+ "--p{4}_dst_start_ip 2.1.1.2 "
+ "--p{4}_dst_end_ip 2.1.1.254 "
+ "--p{4}_src_start_ip 20.20.20.2 "
+ "--p{5}_dst_start_ip 1.1.1.2 "
+ "--p{5}_dst_end_ip 1.1.1.254 "
+ "--p{5}_src_start_ip 10.10.10.2 "
+ "{6} {7} --warmup_time={8}'".format(Constants.REMOTE_FW_DIR,
+ duration, rate, framesize,
+ _p0, _p1, _async, _latency,
+ warmup_time),
+ timeout=int(duration)+60)
else:
raise NotImplementedError('Unsupported traffic type')
diff --git a/resources/libraries/robot/DPDK/default.robot b/resources/libraries/robot/DPDK/default.robot
index b15d48a1d4..070350a082 100644
--- a/resources/libraries/robot/DPDK/default.robot
+++ b/resources/libraries/robot/DPDK/default.robot
@@ -18,6 +18,7 @@
| Library | resources.libraries.python.DUTSetup
| Library | resources.libraries.python.TGSetup
| Library | resources.libraries.python.DPDK.L2fwdTest
+| Library | resources.libraries.python.DPDK.L3fwdTest
| Library | Collections
*** Keywords ***
@@ -65,3 +66,45 @@
| | ... | ${jumbo_frames}
| | Start the l2fwd test | ${dut2} | ${dut2_cpus} | ${nb_cores} | ${rxqueues}
| | ... | ${jumbo_frames}
+
+| Start L3FWD '${m}' worker threads and rxqueues '${n}' with jumbo frames '${b}'
+| | [Documentation] | Start the l3fwd with M worker threads without SMT
+| | ... | and rxqueues N and B(yes or no) jumbo frames in all DUTs.
+| | ${cpu_cnt}= | Convert To Integer | ${m}
+| | ${nb_cores}= | Convert to String | ${m}
+| | ${rxqueues}= | Convert to String | ${n}
+| | ${jumbo_frames}= | Convert to String | ${b}
+| | ${dut1_numa}= | Get interfaces numa node | ${dut1}
+| | ... | ${dut1_if1} | ${dut1_if2}
+| | ${dut2_numa}= | Get interfaces numa node | ${dut2}
+| | ... | ${dut2_if1} | ${dut2_if2}
+| | ${dut1_cpus}= | Cpu List Per Node Str | ${dut1} | ${dut1_numa}
+| | ... | cpu_cnt=${cpu_cnt}
+| | ${dut2_cpus}= | Cpu List Per Node Str | ${dut2} | ${dut2_numa}
+| | ... | cpu_cnt=${cpu_cnt}
+| | Start the l3fwd test | ${nodes} | ${dut1} | ${dut1_if1} | ${dut1_if2}
+| | ... | ${nb_cores} | ${dut1_cpus} | ${rxqueues} | ${jumbo_frames}
+| | Start the l3fwd test | ${nodes} | ${dut2} | ${dut2_if1} | ${dut2_if2}
+| | ... | ${nb_cores} | ${dut2_cpus} | ${rxqueues} | ${jumbo_frames}
+
+| Start L3FWD '${m}' worker threads using SMT and rxqueues '${n}' with jumbo frames '${b}'
+| | [Documentation] | Start the l3fwd with M worker threads with SMT
+| | ... | and rxqueues N and B(yes or no) jumbo frames in all DUTs.
+| | ${cpu_cnt}= | Convert To Integer | ${m}
+| | ${nb_cores_int}= | Evaluate | ${cpu_cnt}*2
+| | ${nb_cores}= | Convert to String | ${nb_cores_int}
+| | ${rxqueues}= | Convert to String | ${n}
+| | ${jumbo_frames}= | Convert to String | ${b}
+| | ${dut1_numa}= | Get interfaces numa node | ${dut1}
+| | ... | ${dut1_if1} | ${dut1_if2}
+| | ${dut2_numa}= | Get interfaces numa node | ${dut2}
+| | ... | ${dut2_if1} | ${dut2_if2}
+| | ${dut1_cpus}= | Cpu List Per Node Str | ${dut1} | ${dut1_numa}
+| | ... | cpu_cnt=${cpu_cnt} | smt_used=${True}
+| | ${dut2_cpus}= | Cpu List Per Node Str | ${dut2} | ${dut2_numa}
+| | ... | cpu_cnt=${cpu_cnt} | smt_used=${True}
+| | Start the l3fwd test | ${nodes} | ${dut1} | ${dut1_if1} | ${dut1_if2}
+| | ... | ${nb_cores} | ${dut1_cpus} | ${rxqueues} | ${jumbo_frames}
+| | Start the l3fwd test | ${nodes} | ${dut2} | ${dut2_if1} | ${dut2_if2}
+| | ... | ${nb_cores} | ${dut2_cpus} | ${rxqueues} | ${jumbo_frames}
+