Mon, Dec 14, 2020 at 11:59:27AM CET, jurbanov(a)redhat.com wrote:
From: Jozef Urbanovsky <jurbanov(a)redhat.com>
Adding parameter for the forward-mode selection of the
testPMD application running during the recipe.
Branching is currently supporting only "mac" and "macswap"
modes, where later needs the upstream DPDK to function
properly. Therefore DPDK is built manually before the
recipe run and requires "dpdk-testpmd" utility.
If you're referring to something downstream, please remove it.
Signed-off-by: Jozef Urbanovsky <jurbanov(a)redhat.com>
---
lnst/Tests/TestPMD.py | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/lnst/Tests/TestPMD.py b/lnst/Tests/TestPMD.py
index a92a42a..dfb89ad 100644
--- a/lnst/Tests/TestPMD.py
+++ b/lnst/Tests/TestPMD.py
@@ -4,27 +4,43 @@ import signal
from lnst.Common.Parameters import Param, StrParam, IntParam, FloatParam
from lnst.Common.Parameters import IpParam, DeviceOrIpParam
from lnst.Tests.BaseTestModule import BaseTestModule, TestModuleError
+from lnst.Common.LnstError import LnstError
+
class TestPMD(BaseTestModule):
coremask = StrParam(mandatory=True)
pmd_coremask = StrParam(mandatory=True)
- #TODO make ListParam
+ # TODO make ListParam
+ mode = StrParam(mandatory=True)
I'd rename this to forward_mode. The mode is too generic imo.
nics = Param(mandatory=True)
- peer_macs = Param(mandatory=True)
+ peer_macs = Param(mandatory=False)
def format_command(self):
- testpmd_args = ["testpmd",
- "-c", self.params.coremask,
- "-n", "4", "--socket-mem",
"1024,0"]
- for nic in self.params.nics:
- testpmd_args.extend(["-w", nic])
+ if self.params.mode == "macswap":
+ testpmd_args = ["dpdk-testpmd", "--no-pci"]
+ else:
+ testpmd_args = ["testpmd"]
+
+ testpmd_args.extend(["-c", self.params.coremask,
+ "-n", "4", "--socket-mem",
"1024,0"])
+
+ for i, nic in enumerate(self.params.nics):
+ if self.params.mode == "mac":
+ testpmd_args.extend(["-w", nic])
+ elif self.params.mode == "macswap":
+
testpmd_args.extend([f"--vdev=net_virtio_user{i+1},path=/var/run/openvswitch/{nic}"])
+ else:
+ LnstError("Unsupported forward-mode parameter selected for the
TestPMD.")
- testpmd_args.extend(["--", "-i", "--forward-mode",
"mac",
+ testpmd_args.extend(["--", "-i", "--forward-mode",
self.params.mode,
"--coremask", self.params.pmd_coremask])
- for i, mac in enumerate(self.params.peer_macs):
- testpmd_args.extend(["--eth-peer", "{},{}".format(i,
mac)])
+ if self.params.mode == "mac":
+ for i, mac in enumerate(self.params.peer_macs):
+ testpmd_args.extend(["--eth-peer", "{},{}".format(i,
mac)])
+ elif self.params.mode == "macswap":
+ testpmd_args.extend(["--port-topology=loop"])
return " ".join(testpmd_args)
--
2.28.0
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...