diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/component_factory.py | 5 | ||||
-rw-r--r-- | core/loader/loader_servant.py | 4 | ||||
-rw-r--r-- | core/pktfwd_controller.py | 9 |
3 files changed, 11 insertions, 7 deletions
diff --git a/core/component_factory.py b/core/component_factory.py index 9c58fc5c..a91872e2 100644 --- a/core/component_factory.py +++ b/core/component_factory.py @@ -118,13 +118,14 @@ def create_loadgen(loadgen_type, loadgen_cfg): elif loadgen_type.find("stress") >= 0: return Stress(loadgen_cfg) -def create_pktfwd(pktfwd_class): +def create_pktfwd(deployment, pktfwd_class): """Return a new packet forwarder controller The returned controller is configured with the given packet forwarder class. :param pktfwd_class: Reference to packet forwarder class to be used. + :param deployment: The deployment scenario name :return: packet forwarder controller """ - return PktFwdController(pktfwd_class) + return PktFwdController(deployment, pktfwd_class) diff --git a/core/loader/loader_servant.py b/core/loader/loader_servant.py index dc6353ff..226b0931 100644 --- a/core/loader/loader_servant.py +++ b/core/loader/loader_servant.py @@ -90,8 +90,8 @@ class LoaderServant(object): desc = (mod.__doc__ or 'No description').strip().split('\n')[0] results.append((name, desc)) - output = [ - 'Classes derived from: ' + self._interface.__name__ + '\n======\n'] + header = 'Classes derived from: ' + self._interface.__name__ + output = [header + '\n' + '=' * len(header) + '\n'] for (name, desc) in results: output.append('* %-18s%s' % ('%s:' % name, desc)) diff --git a/core/pktfwd_controller.py b/core/pktfwd_controller.py index 40565504..b1e37f2e 100644 --- a/core/pktfwd_controller.py +++ b/core/pktfwd_controller.py @@ -24,11 +24,12 @@ class PktFwdController(object): _pktfwd_class: The packet forwarder class to be used. _pktfwd: The packet forwarder object controlled by this controller """ - def __init__(self, pktfwd_class): + def __init__(self, deployment, pktfwd_class): """Initializes up the prerequisites for the P2P deployment scenario. :vswitch_class: the vSwitch class to be used. """ + self._deployment = deployment self._logger = logging.getLogger(__name__) self._pktfwd_class = pktfwd_class self._pktfwd = pktfwd_class() @@ -52,10 +53,12 @@ class PktFwdController(object): self._pktfwd.stop() def __enter__(self): - self.setup() + if self._deployment.find("p2p") == 0: + self.setup() def __exit__(self, type_, value, traceback): - self.stop() + if self._deployment.find("p2p") == 0: + self.stop() def get_pktfwd(self): """Get the controlled packet forwarder |