diff options
-rw-r--r-- | conf/__init__.py | 6 | ||||
-rw-r--r-- | core/traffic_controller_rfc2544.py | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | tools/pkt_gen/ixnet/ixnetrfc2544.tcl | 16 | ||||
-rwxr-xr-x | vsperf | 16 |
4 files changed, 42 insertions, 14 deletions
diff --git a/conf/__init__.py b/conf/__init__.py index 0af47adb..46228235 100644 --- a/conf/__init__.py +++ b/conf/__init__.py @@ -49,6 +49,12 @@ class Settings(object): # we can assume all uppercase keys are valid settings super(Settings, self).__setattr__(name, value) + def setValue(self, name, value): + """Set a value + """ + if name is not None and value is not None: + super(Settings, self).__setattr__(name, value) + def load_from_file(self, path): """Update ``settings`` with values found in module at ``path``. """ diff --git a/core/traffic_controller_rfc2544.py b/core/traffic_controller_rfc2544.py index aae3ef81..e8f1e2a0 100644 --- a/core/traffic_controller_rfc2544.py +++ b/core/traffic_controller_rfc2544.py @@ -39,10 +39,20 @@ class TrafficControllerRFC2544(ITrafficController, IResults): self._traffic_gen_class = traffic_gen_class() self._traffic_started = False self._traffic_started_call_count = 0 - self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES') self._trials = get_test_param('rfc2544_trials', 1) + self._duration = get_test_param('duration', 30) self._results = [] + # If set, comma separated packet_sizes value from --test_params + # on cli takes precedence over value in settings file. + self._packet_sizes = None + packet_sizes_cli = get_test_param('pkt_sizes') + if packet_sizes_cli: + self._packet_sizes = [int(x.strip()) + for x in packet_sizes_cli.split(',')] + else: + self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES') + def __enter__(self): """Call initialisation function. """ @@ -85,14 +95,14 @@ class TrafficControllerRFC2544(ITrafficController, IResults): if traffic['traffic_type'] == 'back2back': result = self._traffic_gen_class.send_rfc2544_back2back( traffic, trials=int(self._trials), - duration=int(get_test_param('rfc2544_duration', 20))) + duration=self._duration) elif traffic['traffic_type'] == 'continuous': result = self._traffic_gen_class.send_cont_traffic( traffic, time=int(get_test_param('rfc2544_duration', 30))) else: result = self._traffic_gen_class.send_rfc2544_throughput( traffic, trials=int(self._trials), - duration=int(get_test_param('rfc2544_duration', 20))) + duration=self._duration) result = TrafficControllerRFC2544._append_results(result, packet_size) @@ -109,7 +119,7 @@ class TrafficControllerRFC2544(ITrafficController, IResults): self._traffic_gen_class.start_rfc2544_throughput( traffic, trials=int(self._trials), - duration=int(get_test_param('rfc2544_duration', 20))) + duration=self._duration) self._traffic_started = True if len(function['args']) > 0: function['function'](function['args']) diff --git a/tools/pkt_gen/ixnet/ixnetrfc2544.tcl b/tools/pkt_gen/ixnet/ixnetrfc2544.tcl index 2a156d3e..d5479b25 100755..100644 --- a/tools/pkt_gen/ixnet/ixnetrfc2544.tcl +++ b/tools/pkt_gen/ixnet/ixnetrfc2544.tcl @@ -252,7 +252,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -destMacRetryCount 1 \ -maxTrafficGenerationQueries 500 \ -enableStaggeredTransmit False \ - -learningFrameSize 64 \ + -learningFrameSize $frameSize \ -useTxRxSync True \ -enableDestMacRetry True \ -enableMulticastScalingFactor False \ @@ -7772,7 +7772,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -tolerance 0 \ -frameLossUnit {0} \ -staggeredStart False \ - -framesizeList {64} \ + -framesizeList $frameSize \ -frameSizeMode custom \ -rateSelect percentMaxRate \ -percentMaxRate 100 \ @@ -7843,7 +7843,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -enableFastConvergence $fastConvergence \ -fastConvergenceDuration $convergenceDuration \ -fastConvergenceThreshold 10 \ - -framesizeFixedValue 128 \ + -framesizeFixedValue $frameSize \ -gap 3 \ -unchangedInitial False \ -generateTrackingOptionAggregationFiles False \ @@ -7856,7 +7856,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -imixData {{{{64}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 40}}{{128}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 30}}{{256}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 30}}}} \ -imixEnabled False \ -imixTemplates none \ - -framesizeImixList {64} \ + -framesizeImixList $frameSize \ -imixTrafficType {UNCHNAGED} \ -mapType {oneToOne} \ -supportedTrafficTypes {mac,ipv4,ipv6,ipmix} @@ -7865,8 +7865,8 @@ proc startRfc2544Test { testSpec trafficSpec } { -learnNumFrames 10 \ -learnRate 100 \ -learnWaitTime 1000 \ - -learnFrameSize 64 \ - -fastPathLearnFrameSize 64 \ + -learnFrameSize $frameSize \ + -fastPathLearnFrameSize $frameSize \ -learnWaitTimeBeforeTransmit 0 \ -learnSendMacOnly False \ -learnSendRouterSolicitation False \ @@ -7945,7 +7945,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -tolerance 0 \ -frameLossUnit {0} \ -staggeredStart False \ - -framesizeList {64} \ + -framesizeList $frameSize \ -frameSizeMode custom \ -rateSelect percentMaxRate \ -percentMaxRate 100 \ @@ -7997,7 +7997,7 @@ proc startRfc2544Test { testSpec trafficSpec } { -imixData {{{{64}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 40}}{{128}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 30}}{{256}{{TOS S:0 S:0 S:0 S:0 S:0} S:0}{1 30}}}} \ -imixEnabled False \ -imixTemplates none \ - -framesizeImixList {64} \ + -framesizeImixList $frameSize \ -imixTrafficType {UNCHNAGED} \ -ipRatioMode fixed \ -ipv4RatioList {10,25,50,75,90} \ @@ -56,7 +56,9 @@ def parse_arguments(): """ Parse and split the '--test-params' argument. - This expects either 'x=y' or 'x' (implicit true) values. + This expects either 'x=y', 'x=y,z' or 'x' (implicit true) + values. For multiple overrides use a ; separated list for + e.g. --test-params 'x=z; y=a,b' """ def __call__(self, parser, namespace, values, option_string=None): results = {} @@ -137,6 +139,7 @@ def parse_arguments(): group.add_argument('--trafficgen', help='traffic generator to use') group.add_argument('--vswitch', help='vswitch implementation to use') group.add_argument('--vnf', help='vnf to use') + group.add_argument('--duration', help='traffic transmit duration') group.add_argument('--sysmetrics', help='system metrics logger to use') group = parser.add_argument_group('test behavior options') group.add_argument('--xunit', action='store_true', @@ -148,7 +151,9 @@ def parse_arguments(): group.add_argument('--conf-file', action=_ValidateFileAction, help='settings file') group.add_argument('--test-params', action=_SplitTestParamsAction, - help='csv list of test parameters: key=val;...') + help='csv list of test parameters: key=val; e.g.' + 'including pkt_sizes=x,y; duration=x; ' + 'rfc2544_trials=x ...') args = vars(parser.parse_args()) @@ -325,6 +330,13 @@ def main(): settings.getValue('vnf_dir')) sys.exit(1) + if args['duration']: + if args['duration'].isdigit() and int(args['duration']) > 0: + settings.setValue('duration', args['duration']) + else: + logging.error('The selected Duration is not a number') + sys.exit(1) + # generate results directory name date = datetime.datetime.fromtimestamp(time.time()) results_dir = "results_" + date.strftime('%Y-%m-%d_%H-%M-%S') |