aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/traffic_profile
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2016-12-30 09:21:22 -0800
committerDeepak S <deepak.s@linux.intel.com>2017-01-19 08:27:31 +0530
commita8075ff20b2046f847b91085aa27f2b336823337 (patch)
tree035dbed36ffb23ac4ced52bd06394c4fb159db03 /tests/unit/network_services/traffic_profile
parent6f8fbe8acb94448ef2eb188193e9bea534021e89 (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 'tests/unit/network_services/traffic_profile')
-rw-r--r--tests/unit/network_services/traffic_profile/__init__.py0
-rw-r--r--tests/unit/network_services/traffic_profile/test_base.py62
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/unit/network_services/traffic_profile/__init__.py b/tests/unit/network_services/traffic_profile/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/network_services/traffic_profile/__init__.py
diff --git a/tests/unit/network_services/traffic_profile/test_base.py b/tests/unit/network_services/traffic_profile/test_base.py
new file mode 100644
index 000000000..72b097b52
--- /dev/null
+++ b/tests/unit/network_services/traffic_profile/test_base.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# 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.
+#
+
+# Unittest for yardstick.network_services.traffic_profile.test_base
+
+from __future__ import absolute_import
+import unittest
+import mock
+
+from yardstick.network_services.traffic_profile.base import \
+ TrafficProfile, DummyProfile
+
+
+class TestTrafficProfile(unittest.TestCase):
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64}}
+
+ def _get_res_mock(self, **kw):
+ _mock = mock.MagicMock()
+ for k, v in kw.items():
+ setattr(_mock, k, v)
+ return _mock
+
+ def test___init__(self):
+ traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
+ self.assertEqual(self.TRAFFIC_PROFILE, traffic_profile.params)
+
+ def test_execute(self):
+ traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
+ self.assertRaises(NotImplementedError, traffic_profile.execute, {})
+
+ def test_get(self):
+ traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
+ self.assertRaises(RuntimeError, traffic_profile.get,
+ self.TRAFFIC_PROFILE)
+
+
+class TestDummyProfile(unittest.TestCase):
+ def test_execute(self):
+ dummy_profile = DummyProfile(TrafficProfile)
+ self.assertIsNone(dummy_profile.execute({}))