1 # Copyright (c) 2016-2017 Intel Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """ Fixed traffic profile definitions """
16 from __future__ import absolute_import
20 from yardstick.network_services.traffic_profile.prox_profile import ProxProfile
22 LOG = logging.getLogger(__name__)
25 class ProxACLProfile(ProxProfile):
27 This profile adds a single stream at the beginning of the traffic session
30 def __init__(self, tp_config):
31 super(ProxACLProfile, self).__init__(tp_config)
33 def run_test_with_pkt_size(self, traffic_gen, pkt_size, duration):
34 """Run the test for a single packet size.
36 :param traffic_gen: traffic generator instance
37 :type traffic_gen: TrafficGen
38 :param pkt_size: The packet size to test with.
40 :param duration: The duration for each try.
45 test_value = self.upper_bound
46 # throughput and packet loss from the last successful test
47 for _ in range(self.prox_config["attempts"]):
48 result, port_samples = self._profile_helper.run_test(pkt_size, duration,
49 test_value, self.tolerated_loss)
51 samples = result.get_samples(pkt_size, result.pkt_loss, port_samples)
52 self.queue.put(samples)