diff options
-rw-r--r-- | conf/03_traffic.conf | 19 | ||||
-rw-r--r-- | core/results/results_constants.py | 9 | ||||
-rw-r--r-- | docs/testing/developer/devguide/design/vswitchperf_design.rst | 14 | ||||
-rw-r--r-- | docs/testing/user/configguide/trafficgen.rst | 12 | ||||
-rw-r--r-- | tools/load_gen/stressorvm/stressor_vm.py | 41 | ||||
-rw-r--r-- | tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py | 40 | ||||
-rw-r--r-- | tools/pkt_gen/testcenter/testcenter.py | 15 |
7 files changed, 143 insertions, 7 deletions
diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 486ab2c8..d3269078 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -209,6 +209,20 @@ LOG_FILE_TRAFFIC_GEN = 'traffic-gen.log' # 'enabled' - Specifies if the histogram provisioning is enabled or not. # 'type' - Defines how histogram is provided. Currenty only 'Default' is defined. # 'Default' - Default histogram as provided by the Traffic-generator. +# 'imix' - A dictionary for IMIX Specification. +# 'enabled' - Specifies if IMIX is enabled or NOT. +# 'type' - The specification type - denotes how IMIX is specified. +# Currently only 'genome' type is defined. +# Other types (ex: table-of-proportions) can be added in future. +# 'genome' - The Genome Encoding of Pkt-Sizes and Ratio for IMIX. +# The ratio is inferred from the number of particular geneome characters. +# Genome encoding is described in RFC 6985. This specification is closest +# to the method described in section 6.2 of RFC 6985. +# Ex: 'aaaaaaaddddg' denotes ratio of 7:4:1 of packets sizes 64:512:1518. +# Note: Exact-sequence is not maintained, only the ratio of packets +# is ensured. +# Data type: str +# Default Value: 'aaaaaaaddddg' TRAFFIC = { 'traffic_type' : 'rfc2544_throughput', 'frame_rate' : 100, @@ -264,6 +278,11 @@ TRAFFIC = { 'enabled': False, 'type': 'Default', }, + 'imix': { + 'enabled': False, + 'type': 'genome', + 'genome': 'aaaaaaaddddg', + }, } #path to traffic generators directory. diff --git a/core/results/results_constants.py b/core/results/results_constants.py index 967adbf9..769938a8 100644 --- a/core/results/results_constants.py +++ b/core/results/results_constants.py @@ -73,6 +73,11 @@ class ResultsConstants(object): CAPTURE_TX = "capture_tx" CAPTURE_RX = "capture_rx" + # IMIX Used + IMIX_GENOME = "imix_genome" + # IMIX Avg. Frame Size + IMIX_AVG_FRAMESIZE = "imix_avg_framesize" + @staticmethod def get_traffic_constants(): """Method returns all Constants used to store results. @@ -96,4 +101,6 @@ class ResultsConstants(object): ResultsConstants.MIN_LATENCY_NS, ResultsConstants.MAX_LATENCY_NS, ResultsConstants.AVG_LATENCY_NS, - ResultsConstants.FRAME_LOSS_PERCENT] + ResultsConstants.FRAME_LOSS_PERCENT, + ResultsConstants.IMIX_GENOME, + ResultsConstants.IMIX_AVG_FRAMESIZE] diff --git a/docs/testing/developer/devguide/design/vswitchperf_design.rst b/docs/testing/developer/devguide/design/vswitchperf_design.rst index bc54476c..50682a93 100644 --- a/docs/testing/developer/devguide/design/vswitchperf_design.rst +++ b/docs/testing/developer/devguide/design/vswitchperf_design.rst @@ -477,6 +477,20 @@ Detailed description of ``TRAFFIC`` dictionary items follows: 'enabled' - Specifies if the histogram provisioning is enabled or not. 'type' - Defines how histogram is provided. Currenty only 'Default' is defined. 'Default' - Default histogram as provided by the Traffic-generator. + 'imix' - A dictionary for IMIX Specification. + 'enabled' - Specifies if IMIX is enabled or NOT. + 'type' - The specification type - denotes how IMIX is specified. + Currently only 'genome' type is defined. + Other types (ex: table-of-proportions) can be added in future. + 'genome' - The Genome Encoding of Pkt-Sizes and Ratio for IMIX. + The Ratio is inferred from the number of particular geneome characters + Genome encoding is described in RFC 6985. This specification is closest + to the method described in section 6.2 of RFC 6985. + Ex: 'aaaaaaaddddg' denotes ratio of 7:4:1 of packets sizes 64:512:1518. + Note: Exact-sequence is not maintained, only the ratio of packets + is ensured. + Data type: str + Default Value: 'aaaaaaaddddg' .. _configuration-of-guest-options: diff --git a/docs/testing/user/configguide/trafficgen.rst b/docs/testing/user/configguide/trafficgen.rst index ae745543..705e5397 100644 --- a/docs/testing/user/configguide/trafficgen.rst +++ b/docs/testing/user/configguide/trafficgen.rst @@ -91,6 +91,11 @@ and is configured as follows: 'enabled': False, 'type': 'Default', }, + 'imix': { + 'enabled': True, + 'type': 'genome', + 'genome': 'aaaaaaaddddg', + }, } A detailed description of the ``TRAFFIC`` dictionary can be found at @@ -119,6 +124,13 @@ commandline above to: $ ./vsperf --test-params "TRAFFICGEN_PKT_SIZES=(x,y);TRAFFICGEN_DURATION=10;" \ "TRAFFICGEN_RFC2544_TESTS=1" $TESTNAME +If you use imix, set the TRAFFICGEN_PKT_SIZES to 0. + +.. code-block:: console + + TRAFFICGEN_PKT_SIZES = (0,) + + .. _trafficgen-dummy: Dummy diff --git a/tools/load_gen/stressorvm/stressor_vm.py b/tools/load_gen/stressorvm/stressor_vm.py index f4936743..82329d2b 100644 --- a/tools/load_gen/stressorvm/stressor_vm.py +++ b/tools/load_gen/stressorvm/stressor_vm.py @@ -16,8 +16,12 @@ Wrapper file to create and manage Stressor-VM as loadgen """ +import locale import logging import os +import re +import subprocess +import time from tools import tasks from tools.load_gen.load_gen import ILoadGenerator from conf import settings as S @@ -90,8 +94,42 @@ class QemuVM(tasks.Process): 'Removing content of shared directory...', True) self._running = False + def affinitize_nn(self): + """ + Affinitize the SMP cores of a NN instance. + This function is same as the one in vnfs/qemu/qemu.py + + :returns: None + """ + thread_id = (r'.* CPU #%d: .* thread_id=(\d+)') + cur_locale = locale.getdefaultlocale()[1] + proc = subprocess.Popen( + ('echo', 'info cpus'), stdout=subprocess.PIPE) + while not os.path.exists(self._monitor): + time.sleep(1) + output = subprocess.check_output( + ('sudo', 'socat', '-', 'UNIX-CONNECT:%s' % self._monitor), + stdin=proc.stdout) + proc.wait() + + # calculate the number of CPUs specified by NN_SMP + cpu_nr = int(S.getValue('NN_SMP')[self._number]) + # pin each NN's core to host core based on configured BINDING + for cpu in range(0, cpu_nr): + match = None + guest_thread_binding = S.getValue('NN_CORE_BINDING')[self._number] + for line in output.decode(cur_locale).split('\n'): + match = re.search(thread_id % cpu, line) + if match: + self._affinitize_pid(guest_thread_binding[cpu], + match.group(1)) + break + if not match: + self._logger.error('Failed to affinitize guest core #%d. Could' + ' not parse tid.', cpu) + -# pylint: disable=super-init-not-called +# pylint: disable=super-init-not-called,unused-argument class StressorVM(ILoadGenerator): """ Wrapper Class for Load-Generation through stressor-vm @@ -107,6 +145,7 @@ class StressorVM(ILoadGenerator): """ for nvm in self.qvm_list: nvm.start() + nvm.affinitize_nn() def kill(self, signal='-9', sleep=2): """ diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py index 1ed12968..4054d0e6 100644 --- a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py +++ b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py @@ -22,12 +22,26 @@ TestCenter REST APIs. This test supports Python 3.4 ''' import argparse +import collections import logging import os import sqlite3 _LOGGER = logging.getLogger(__name__) +GENOME_PKTSIZE_ENCODING = {"a": 64, "b": 128, "c": 256, "d": 512, + "e": 1024, "f": 1280, "g": 1518, "h": 2112} + + +def genome2weights(sequence): + """ Convert genome sequence to packetsize weights""" + weights = collections.defaultdict(int) + for char in GENOME_PKTSIZE_ENCODING: + charcount = sequence.count(char) + if charcount: + weights[GENOME_PKTSIZE_ENCODING[char]] = charcount + return weights + def create_dir(path): """Create the directory as specified in path """ @@ -291,6 +305,12 @@ def main(): action="store_true", help="latency histogram is required in output?", dest="latency_histogram") + optional_named.add_argument("--imix", + required=False, + default="", + help=("IMIX specification as genome" + "Encoding - RFC 6985"), + dest="imix") parser.add_argument("-v", "--verbose", required=False, @@ -377,7 +397,7 @@ def main(): # Create the DeviceGenEthIIIfParams object stc.create("DeviceGenEthIIIfParams", under=east_device_gen_params, - attributes={'UseDefaultPhyMac':True}) + attributes={'UseDefaultPhyMac': True}) # Configuring Ipv4 interfaces stc.create("DeviceGenIpv4IfParams", @@ -400,7 +420,7 @@ def main(): # Create the DeviceGenEthIIIfParams object stc.create("DeviceGenEthIIIfParams", under=west_device_gen_params, - attributes={'UseDefaultPhyMac':True}) + attributes={'UseDefaultPhyMac': True}) # Configuring Ipv4 interfaces stc.create("DeviceGenIpv4IfParams", @@ -443,6 +463,19 @@ def main(): gBucketSizeList = stc.get(wLatHist, 'BucketSizeList') # gLimitSizeList = stc.get(wLatHist, 'LimitList') + # IMIX configuration + fld = None + if args.imix: + args.frame_size_list = [] + weights = genome2weights(args.imix) + fld = stc.create('FrameLengthDistribution', under=project) + def_slots = stc.get(fld, "children-framelengthdistributionslot") + stc.perform("Delete", params={"ConfigList": def_slots}) + for fsize in weights: + stc.create('framelengthdistributionslot', under=fld, + attributes={'FixedFrameLength': fsize, + 'Weight': weights[fsize]}) + # Create the RFC 2544 'metric test if args.metric == "throughput": if args.verbose: @@ -460,7 +493,8 @@ def main(): "RateUpperLimit": args.rate_upper_limit_pct, "Resolution": args.resolution_pct, "SearchMode": args.search_mode, - "TrafficPattern": args.traffic_pattern}) + "TrafficPattern": args.traffic_pattern, + "FrameSizeDistributionList": fld}) elif args.metric == "backtoback": stc.perform("Rfc2544SetupBackToBackTestCommand", params={"AcceptableFrameLoss": diff --git a/tools/pkt_gen/testcenter/testcenter.py b/tools/pkt_gen/testcenter/testcenter.py index 7afa3d8d..af30cd73 100644 --- a/tools/pkt_gen/testcenter/testcenter.py +++ b/tools/pkt_gen/testcenter/testcenter.py @@ -332,7 +332,7 @@ class TestCenter(trafficgen.ITrafficGenerator): return self.get_rfc2889_addr_learning_results(filec) - def get_rfc2544_results(self, filename): + def get_rfc2544_results(self, filename, genome=None): """ Reads the CSV file and return the results """ @@ -367,6 +367,10 @@ class TestCenter(trafficgen.ITrafficGenerator): row["AverageLatency(us)"]) * 1000 result[ResultsConstants.FRAME_LOSS_PERCENT] = float( row["PercentLoss"]) + if genome: + result[ResultsConstants.IMIX_GENOME] = genome + result[ResultsConstants.IMIX_AVG_FRAMESIZE] = float( + row["AvgFrameSize"]) return result def send_cont_traffic(self, traffic=None, duration=30): @@ -426,6 +430,13 @@ class TestCenter(trafficgen.ITrafficGenerator): if traffic['latency_histogram']['type'] == 'Default': args.append("--latency_histogram") + genome = '' + if traffic and 'imix' in traffic: + if traffic['imix']['enabled']: + if traffic['imix']['type'] == 'genome': + genome = traffic['imix']['genome'] + args.append('--imix' + ' ' + genome) + if settings.getValue("TRAFFICGEN_STC_VERBOSE") == "True": args.append("--verbose") verbose = True @@ -440,7 +451,7 @@ class TestCenter(trafficgen.ITrafficGenerator): if verbose: self._logger.info("file: %s", filec) - return self.get_rfc2544_results(filec) + return self.get_rfc2544_results(filec, genome) def send_rfc2544_back2back(self, traffic=None, tests=1, duration=20, lossrate=0.0): |