aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/component_factory.py5
-rw-r--r--core/loader/loader_servant.py4
-rw-r--r--core/pktfwd_controller.py9
-rw-r--r--core/results/results_constants.py2
-rw-r--r--core/traffic_controller_rfc2544.py5
-rw-r--r--core/vnf_controller.py9
-rw-r--r--core/vswitch_controller_op2p.py18
-rw-r--r--core/vswitch_controller_pvp.py2
-rw-r--r--core/vswitch_controller_pvvp.py2
9 files changed, 37 insertions, 19 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
diff --git a/core/results/results_constants.py b/core/results/results_constants.py
index 1049e89b..b7ab7052 100644
--- a/core/results/results_constants.py
+++ b/core/results/results_constants.py
@@ -59,6 +59,8 @@ class ResultsConstants(object):
SCAL_STREAM_TYPE = 'match_type'
SCAL_PRE_INSTALLED_FLOWS = 'pre-installed_flows'
+ TEST_RUN_TIME = "test_execution_time"
+
@staticmethod
def get_traffic_constants():
"""Method returns all Constants used to store results.
diff --git a/core/traffic_controller_rfc2544.py b/core/traffic_controller_rfc2544.py
index 2630101f..81e499cd 100644
--- a/core/traffic_controller_rfc2544.py
+++ b/core/traffic_controller_rfc2544.py
@@ -41,6 +41,7 @@ class TrafficControllerRFC2544(ITrafficController, IResults):
self._traffic_started_call_count = 0
self._trials = int(get_test_param('rfc2544_trials', 1))
self._duration = int(get_test_param('duration', 30))
+ self._lossrate = float(get_test_param('lossrate', 0.0))
self._results = []
# If set, comma separated packet_sizes value from --test_params
@@ -100,13 +101,13 @@ class TrafficControllerRFC2544(ITrafficController, IResults):
if traffic['traffic_type'] == 'back2back':
result = self._traffic_gen_class.send_rfc2544_back2back(
- traffic, trials=self._trials, duration=self._duration)
+ traffic, trials=self._trials, duration=self._duration, lossrate=self._lossrate)
elif traffic['traffic_type'] == 'continuous':
result = self._traffic_gen_class.send_cont_traffic(
traffic, duration=self._duration)
else:
result = self._traffic_gen_class.send_rfc2544_throughput(
- traffic, trials=self._trials, duration=self._duration)
+ traffic, trials=self._trials, duration=self._duration, lossrate=self._lossrate)
result = TrafficControllerRFC2544._append_results(result,
packet_size)
diff --git a/core/vnf_controller.py b/core/vnf_controller.py
index 39a63044..8800ccaf 100644
--- a/core/vnf_controller.py
+++ b/core/vnf_controller.py
@@ -15,6 +15,7 @@
"""
import logging
+import pexpect
from vnfs.vnf.vnf import IVnf
class VnfController(object):
@@ -68,8 +69,12 @@ class VnfController(object):
"""
self._logger.debug('start ' + str(len(self._vnfs)) +
' VNF[s] with ' + ' '.join(map(str, self._vnfs)))
- for vnf in self._vnfs:
- vnf.start()
+ try:
+ for vnf in self._vnfs:
+ vnf.start()
+ except pexpect.TIMEOUT:
+ self.stop()
+ raise
def stop(self):
"""Stops all VNFs set-up by __init__.
diff --git a/core/vswitch_controller_op2p.py b/core/vswitch_controller_op2p.py
index 77797b8f..ee8ada8b 100644
--- a/core/vswitch_controller_op2p.py
+++ b/core/vswitch_controller_op2p.py
@@ -77,11 +77,13 @@ class VswitchControllerOP2P(IVswitchController):
vtep_ip2 = settings.getValue('VTEP_IP2')
self._vswitch.add_switch(bridge)
- tasks.run_task(['sudo', 'ifconfig', bridge,
- settings.getValue('VTEP_IP1')],
+ tasks.run_task(['sudo', 'ip', 'addr', 'add',
+ settings.getValue('VTEP_IP1'), 'dev', bridge],
self._logger, 'Assign ' +
settings.getValue('VTEP_IP1') + ' to ' + bridge,
False)
+ tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+ self._logger, 'Bring up ' + bridge, False)
tunnel_type = self._traffic['tunnel_type']
@@ -137,10 +139,12 @@ class VswitchControllerOP2P(IVswitchController):
tgen_ip1 = settings.getValue('TRAFFICGEN_PORT1_IP')
self._vswitch.add_switch(bridge)
- tasks.run_task(['sudo', 'ifconfig', bridge,
- settings.getValue('VTEP_IP1')],
+ tasks.run_task(['sudo', 'ip', 'addr', 'add',
+ settings.getValue('VTEP_IP1'), 'dev', bridge],
self._logger, 'Assign ' +
settings.getValue('VTEP_IP1') + ' to ' + bridge, False)
+ tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+ self._logger, 'Bring up ' + bridge, False)
tunnel_type = self._traffic['tunnel_type']
@@ -195,10 +199,12 @@ class VswitchControllerOP2P(IVswitchController):
tgen_ip1 = settings.getValue('TRAFFICGEN_PORT1_IP')
self._vswitch.add_switch(bridge)
- tasks.run_task(['sudo', 'ifconfig', bridge,
- settings.getValue('TUNNEL_INT_BRIDGE_IP')],
+ tasks.run_task(['sudo', 'ip', 'addr', 'add',
+ settings.getValue('TUNNEL_INT_BRIDGE_IP'), 'dev', bridge],
self._logger, 'Assign ' +
settings.getValue('TUNNEL_INT_BRIDGE_IP') + ' to ' + bridge, False)
+ tasks.run_task(['sudo', 'ip', 'link', 'set', 'dev', bridge, 'up'],
+ self._logger, 'Bring up ' + bridge, False)
tunnel_type = self._traffic['tunnel_type']
diff --git a/core/vswitch_controller_pvp.py b/core/vswitch_controller_pvp.py
index 0c98cc7f..a4f61961 100644
--- a/core/vswitch_controller_pvp.py
+++ b/core/vswitch_controller_pvp.py
@@ -77,7 +77,7 @@ class VswitchControllerPVP(IVswitchController):
self._vswitch.add_flow(bridge, flow1)
self._vswitch.add_flow(bridge, flow2)
- if self._traffic['bidir']:
+ if self._traffic['bidir'] == 'True':
flow3 = add_ports_to_flow(flow_template, phy2_number,
vport2_number)
flow4 = add_ports_to_flow(flow_template, vport1_number,
diff --git a/core/vswitch_controller_pvvp.py b/core/vswitch_controller_pvvp.py
index c79ad9a3..729aca3f 100644
--- a/core/vswitch_controller_pvvp.py
+++ b/core/vswitch_controller_pvvp.py
@@ -82,7 +82,7 @@ class VswitchControllerPVVP(IVswitchController):
self._vswitch.add_flow(bridge, flow2)
self._vswitch.add_flow(bridge, flow3)
- if self._traffic['bidir']:
+ if self._traffic['bidir'] == 'True':
flow4 = add_ports_to_flow(flow_template, phy2_number,
vport4_number)
flow5 = add_ports_to_flow(flow_template, vport3_number,