diff options
author | Deepak S <deepak.s@linux.intel.com> | 2016-12-30 09:21:22 -0800 |
---|---|---|
committer | Deepak S <deepak.s@linux.intel.com> | 2017-01-19 08:27:31 +0530 |
commit | a8075ff20b2046f847b91085aa27f2b336823337 (patch) | |
tree | 035dbed36ffb23ac4ced52bd06394c4fb159db03 /yardstick/network_services/traffic_profile | |
parent | 6f8fbe8acb94448ef2eb188193e9bea534021e89 (diff) |
Introducing Generic framework to do pre-deployment VNF & Network service testing
This patch introduces the framework which is aligned with ETSI-TST001
This patch adds:
1. NetworkServiceTestCase introduces following functions
--> setup
--> Verify if infrastructure mapping can meet topology
--> Load VNF models
--> Fill traffic profile with information from topology
--> Provision VNFs
--> Run experiment (traffic)
--> run -> Yardstick calls run() at intervals defined in the yaml
and produces timestamped samples
--> teardown --> Stop VNFs
2. TrafficProfile is a generic class to get traffic profile for a given
testcase and select the traffic generator for testcase.
3. QueueFileWrapper is a class to send/recive cmds to vnf
4. GenericVNF is a generic class to instantiate VNF
5. GenericTrafficGen is a generic class to run/listen/verify traffic.
JIRA: YARDSTICK-483
Change-Id: Ic453c917d34dcb508a7f3afb459011da85f6402e
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Diffstat (limited to 'yardstick/network_services/traffic_profile')
-rw-r--r-- | yardstick/network_services/traffic_profile/__init__.py | 0 | ||||
-rw-r--r-- | yardstick/network_services/traffic_profile/base.py | 64 |
2 files changed, 64 insertions, 0 deletions
diff --git a/yardstick/network_services/traffic_profile/__init__.py b/yardstick/network_services/traffic_profile/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/yardstick/network_services/traffic_profile/__init__.py diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py new file mode 100644 index 000000000..906498586 --- /dev/null +++ b/yardstick/network_services/traffic_profile/base.py @@ -0,0 +1,64 @@ +# Copyright (c) 2016-2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" Base class for the generic traffic profile implementation """ + +from __future__ import absolute_import +from yardstick.common.utils import import_modules_from_package, itersubclasses + + +class TrafficProfile(object): + """ + This class defines the behavior + + """ + + @staticmethod + def get(tp_config): + """Get the traffic profile instance for the given traffic type + + :param tp_config: loaded YAML file + :return: + """ + profile_class = tp_config["traffic_profile"]["traffic_type"] + import_modules_from_package( + "yardstick.network_services.traffic_profile") + try: + return next(c for c in itersubclasses(TrafficProfile) + if c.__name__ == profile_class)(tp_config) + except StopIteration: + raise RuntimeError("No implementation for %s", profile_class) + + def __init__(self, tp_config): + # e.g. RFC2544 start_ip, stop_ip, drop_rate, + # IMIX = {"10K": 0.1, "100M": 0.5} + self.params = tp_config + + def execute(self, traffic_generator): + """ This methods defines the behavior of the traffic generator. + It will be called in a loop until the traffic generator exits. + + :param traffic_generator: TrafficGen instance + :return: None + """ + raise NotImplementedError() + + +class DummyProfile(TrafficProfile): + """ + This is an empty TrafficProfile implementation - if it is used, + the traffic will be completely handled by the Traffic Generator + implementation with no regard for the Traffic Profile. + """ + def execute(self, traffic_generator): + pass |