aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
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