aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-01-16 07:56:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-16 07:56:57 +0000
commitcafcb9f24b422a4b3a0b19ba00c83fe2819dcbaa (patch)
tree4a5f946ef9da8d81f1d74d7bac90130ba2464f82 /core
parent0b202e7c4f4d88ba32570d245a4d4f7371f5fa3a (diff)
parent3ea19952db315e88263437ed41b0c31bd3bdbdf4 (diff)
Merge "testpmd_pvp: Adds pkt_fwd to allow pvp topology testing"
Diffstat (limited to 'core')
-rw-r--r--core/pktfwd_controller.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/pktfwd_controller.py b/core/pktfwd_controller.py
index b1e37f2e..a0e14d19 100644
--- a/core/pktfwd_controller.py
+++ b/core/pktfwd_controller.py
@@ -32,7 +32,7 @@ class PktFwdController(object):
self._deployment = deployment
self._logger = logging.getLogger(__name__)
self._pktfwd_class = pktfwd_class
- self._pktfwd = pktfwd_class()
+ self._pktfwd = pktfwd_class(guest=True if deployment == "pvp" else False)
self._logger.debug('Creation using ' + str(self._pktfwd_class))
def setup(self):
@@ -46,6 +46,17 @@ class PktFwdController(object):
self._pktfwd.stop()
raise
+ def setup_for_guest(self):
+ """Sets up the packet forwarder for pvp.
+ """
+ self._logger.debug('Setup using ' + str(self._pktfwd_class))
+
+ try:
+ self._pktfwd.start_for_guest()
+ except:
+ self._pktfwd.stop()
+ raise
+
def stop(self):
"""Tears down the packet forwarder created in setup().
"""
@@ -55,10 +66,14 @@ class PktFwdController(object):
def __enter__(self):
if self._deployment.find("p2p") == 0:
self.setup()
+ elif self._deployment == "pvp":
+ self.setup_for_guest()
def __exit__(self, type_, value, traceback):
if self._deployment.find("p2p") == 0:
self.stop()
+ elif self._deployment == "pvp":
+ self.stop()
def get_pktfwd(self):
"""Get the controlled packet forwarder