aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/base.py37
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py22
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ixload.py7
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ping.py12
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_prox.py5
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py7
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_trex.py8
7 files changed, 32 insertions, 66 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/base.py b/yardstick/network_services/vnf_generic/vnf/base.py
index 778119568..8ed754dce 100644
--- a/yardstick/network_services/vnf_generic/vnf/base.py
+++ b/yardstick/network_services/vnf_generic/vnf/base.py
@@ -13,11 +13,14 @@
# limitations under the License.
""" Base class implementation for generic vnf implementation """
-from __future__ import absolute_import
+import abc
+
import logging
+import six
from yardstick.network_services.helpers.samplevnf_helper import PortPairs
+
LOG = logging.getLogger(__name__)
@@ -207,6 +210,7 @@ class GenericVNF(VNFObject):
raise NotImplementedError()
+@six.add_metaclass(abc.ABCMeta)
class GenericTrafficGen(GenericVNF):
""" Class providing file-like API for generic traffic generator """
@@ -215,18 +219,29 @@ class GenericTrafficGen(GenericVNF):
self.runs_traffic = True
self.traffic_finished = False
+ @abc.abstractmethod
def run_traffic(self, traffic_profile):
- """ Generate traffic on the wire according to the given params.
- Method is non-blocking, returns immediately when traffic process
+ """Generate traffic on the wire according to the given params.
+
+ This method is non-blocking, returns immediately when traffic process
is running. Mandatory.
:param traffic_profile:
:return: True/False
"""
- raise NotImplementedError()
+
+ @abc.abstractmethod
+ def terminate(self):
+ """After this method finishes, all traffic processes should stop.
+
+ Mandatory.
+
+ :return: True/False
+ """
def listen_traffic(self, traffic_profile):
- """ Listen to traffic with the given parameters.
+ """Listen to traffic with the given parameters.
+
Method is non-blocking, returns immediately when traffic process
is running. Optional.
@@ -236,16 +251,20 @@ class GenericTrafficGen(GenericVNF):
pass
def verify_traffic(self, traffic_profile):
- """ Verify captured traffic after it has ended. Optional.
+ """Verify captured traffic after it has ended.
+
+ Optional.
:param traffic_profile:
:return: dict
"""
pass
- def terminate(self):
- """ After this method finishes, all traffic processes should stop. Mandatory.
+ def wait_for_instantiate(self):
+ """Wait for an instance to load.
+
+ Optional.
:return: True/False
"""
- raise NotImplementedError()
+ pass
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index ff81b5f5f..20e5895ee 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -895,10 +895,6 @@ class SampleVNFTrafficGen(GenericTrafficGen):
self._tg_process = Process(name=name, target=self._start_server)
self._tg_process.start()
- def wait_for_instantiate(self):
- # overridden by subclasses
- return self._wait_for_process()
-
def _check_status(self):
raise NotImplementedError
@@ -942,24 +938,6 @@ class SampleVNFTrafficGen(GenericTrafficGen):
return self._traffic_process.is_alive()
- def listen_traffic(self, traffic_profile):
- """ Listen to traffic with the given parameters.
- Method is non-blocking, returns immediately when traffic process
- is running. Optional.
-
- :param traffic_profile:
- :return: True/False
- """
- pass
-
- def verify_traffic(self, traffic_profile):
- """ Verify captured traffic after it has ended. Optional.
-
- :param traffic_profile:
- :return: dict
- """
- pass
-
def collect_kpi(self):
# check if the tg processes have exited
for proc in (self._tg_process, self._traffic_process):
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
index 612799ff5..61c045405 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
@@ -170,16 +170,9 @@ class IxLoadTrafficGen(SampleVNFTrafficGen):
self.resource_helper.log()
self.resource_helper.data = self.resource_helper.make_aggregates()
- def listen_traffic(self, traffic_profile):
- pass
-
def instantiate(self, scenario_cfg, context_cfg):
super(IxLoadTrafficGen, self).instantiate(scenario_cfg, context_cfg)
- def wait_for_instantiate(self):
- # not needed for Ixload
- pass
-
def terminate(self):
call(["pkill", "-9", "http_ixload.py"])
super(IxLoadTrafficGen, self).terminate()
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ping.py b/yardstick/network_services/vnf_generic/vnf/tg_ping.py
index 9cd9f2574..30a917862 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ping.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ping.py
@@ -14,7 +14,6 @@
""" PING acts as traffic generation and vnf definitions based on IETS Spec """
from __future__ import absolute_import
-from __future__ import print_function
import logging
import re
@@ -135,14 +134,3 @@ class PingTrafficGen(SampleVNFTrafficGen):
}
self.setup_helper.setup_vnf_environment()
-
- def wait_for_instantiate(self):
- pass
-
- def listen_traffic(self, traffic_profile):
- """ Not needed for ping
-
- :param traffic_profile:
- :return:
- """
- pass
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_prox.py b/yardstick/network_services/vnf_generic/vnf/tg_prox.py
index 40eda753f..151252ce8 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_prox.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_prox.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import print_function, absolute_import
+from __future__ import absolute_import
import logging
@@ -63,9 +63,6 @@ class ProxTrafficGen(SampleVNFTrafficGen):
self.vpci_if_name_ascending = self._sort_vpci(vnfd)
self.resource_helper.vpci_if_name_ascending = self._sort_vpci(vnfd)
- def listen_traffic(self, traffic_profile):
- pass
-
def terminate(self):
self._vnf_wrapper.terminate()
super(ProxTrafficGen, self).terminate()
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index 47c5a35d9..a8b19cfba 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -204,13 +204,6 @@ class IxiaTrafficGen(SampleVNFTrafficGen):
def scale(self, flavor=""):
pass
- def listen_traffic(self, traffic_profile):
- pass
-
def terminate(self):
self.resource_helper.stop_collect()
super(IxiaTrafficGen, self).terminate()
-
- def wait_for_instantiate(self):
- # not needed for IxNet
- pass
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
index 93ba8557a..4250cb7a6 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_trex.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
@@ -14,8 +14,6 @@
""" Trex acts as traffic generation and vnf definitions based on IETS Spec """
from __future__ import absolute_import
-from __future__ import print_function
-
import logging
import os
@@ -191,8 +189,8 @@ class TrexTrafficGen(SampleVNFTrafficGen):
def scale(self, flavor=""):
pass
- def listen_traffic(self, traffic_profile):
- pass
-
def terminate(self):
self.resource_helper.terminate()
+
+ def wait_for_instantiate(self):
+ return self._wait_for_process()