3 # Copyright (c) 2016-2017 Intel Corporation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 # Unittest for yardstick.network_services.traffic_profile.test_base
20 from __future__ import absolute_import
24 from yardstick.network_services.traffic_profile.base import \
25 TrafficProfile, DummyProfile
28 class TestTrafficProfile(unittest.TestCase):
30 "schema": "isb:traffic_profile:0.1",
32 "description": "Fixed traffic profile to run UDP traffic",
34 "traffic_type": "FixedTraffic",
35 "frame_rate": 100, # pps
39 def _get_res_mock(self, **kw):
40 _mock = mock.MagicMock()
41 for k, v in kw.items():
45 def test___init__(self):
46 traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
47 self.assertEqual(self.TRAFFIC_PROFILE, traffic_profile.params)
49 def test_execute(self):
50 traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
51 self.assertRaises(NotImplementedError, traffic_profile.execute_traffic, {})
54 traffic_profile = TrafficProfile(self.TRAFFIC_PROFILE)
55 self.assertRaises(RuntimeError, traffic_profile.get,
59 class TestDummyProfile(unittest.TestCase):
60 def test_execute(self):
61 dummy_profile = DummyProfile(TrafficProfile)
62 self.assertIsNone(dummy_profile.execute({}))