aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pkt_fwd/testpmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pkt_fwd/testpmd.py')
-rw-r--r--tools/pkt_fwd/testpmd.py19
1 files changed, 18 insertions, 1 deletions
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