From 3ea19952db315e88263437ed41b0c31bd3bdbdf4 Mon Sep 17 00:00:00 2001 From: Christian Trautman Date: Wed, 11 Jan 2017 15:00:52 -0500 Subject: testpmd_pvp: Adds pkt_fwd to allow pvp topology testing Requires DPDK 16.11 or greater to support vdev flags. Initial support for TestPMD to support guests. Allows vsperf to execute TestPMD as a switch for pvp test scenarios. Can be increased in functionality later to support multiple guest configs. JIRA: VSPERF-406 Change-Id: I67a5a355c990ca6cfcbb5845a2beaf1c1f21f5f0 Signed-off-by: Christian Trautman --- tools/pkt_fwd/pkt_fwd.py | 6 ++++++ tools/pkt_fwd/testpmd.py | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/pkt_fwd/pkt_fwd.py b/tools/pkt_fwd/pkt_fwd.py index 2580ee1f..a080b5a2 100644 --- a/tools/pkt_fwd/pkt_fwd.py +++ b/tools/pkt_fwd/pkt_fwd.py @@ -44,6 +44,12 @@ class IPktFwd(object): """ raise NotImplementedError('Please call an implementation.') + def start_for_guest(self): + """Start the packet forward for guest config + + :returns: None + """ + def stop(self): """Stop the packet forwarder. diff --git a/tools/pkt_fwd/testpmd.py b/tools/pkt_fwd/testpmd.py index e1b987bc..30e80386 100644 --- a/tools/pkt_fwd/testpmd.py +++ b/tools/pkt_fwd/testpmd.py @@ -24,6 +24,8 @@ from tools.pkt_fwd.pkt_fwd import IPktFwd _LOGGER = logging.getLogger(__name__) _VSWITCHD_CONST_ARGS = ['--', '-i'] +_TESTPMD_PVP_CONST_ARGS = ['--vdev', 'net_vhost0,iface=/tmp/dpdkvhostuser0', + '--vdev', 'net_vhost1,iface=/tmp/dpdkvhostuser1',] class TestPMD(IPktFwd): """TestPMD implementation (only phy2phy deployment is supported) @@ -37,8 +39,10 @@ class TestPMD(IPktFwd): _logger = logging.getLogger() - def __init__(self): + def __init__(self, guest=False): vswitchd_args = settings.getValue('VSWITCHD_DPDK_ARGS') + if guest: + vswitchd_args += _TESTPMD_PVP_CONST_ARGS vswitchd_args += _VSWITCHD_CONST_ARGS vswitchd_args += settings.getValue('TESTPMD_ARGS') @@ -70,6 +74,19 @@ class TestPMD(IPktFwd): self._testpmd.send('start', 1) + def start_for_guest(self): + """See IPktFwd for general description + + Activates testpmd for guest config + """ + self._logger.info("Starting TestPMD for one guest...") + dpdk.init() + self._testpmd.start() + self._logger.info("TestPMD...Started.") + self._testpmd.send('set portlist 0,2,1,3') + + self._testpmd.send('start', 1) + def stop(self): """See IPktFwd for general description -- cgit 1.2.3-korg