diff options
Diffstat (limited to 'tools/pkt_fwd')
-rw-r--r-- | tools/pkt_fwd/pkt_fwd.py | 6 | ||||
-rw-r--r-- | tools/pkt_fwd/testpmd.py | 19 |
2 files changed, 24 insertions, 1 deletions
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 |