bug_fix: process pkt_size/duration from cli 98/1298/4
authorMaryam Tahhan <maryam.tahhan@intel.com>
Thu, 30 Jul 2015 12:44:36 +0000 (13:44 +0100)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Wed, 26 Aug 2015 08:16:32 +0000 (08:16 +0000)
Refactor rfc25444_duration to duration and update the --test-params help
to show the type of parameters that can be set from the cli. Also
configure pkt_sizes so that it can be modified from the CLI. Also fixes
the tcl script to configure framesize properly (to the value selected
and not the default 64b).

JIRA: VSPERF-27

Change-Id: I76dcd824977a5f940cf7476090d2d2a3acca8160
Signed-off-by: Billy O'Mahony<billy.o.mahony@intel.com>
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Dino Madarang <dino.simeonx.madarang@intel.com>
conf/__init__.py
core/traffic_controller_rfc2544.py
tools/pkt_gen/ixnet/ixnetrfc2544.tcl [changed mode: 0755->0644]
vsperf

index 0af47ad..4622823 100644 (file)
@@ -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``.
         """
index aae3ef8..e8f1e2a 100644 (file)
@@ -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'])
old mode 100755 (executable)
new mode 100644 (file)
index 2a156d3..d5479b2
@@ -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} \
diff --git a/vsperf b/vsperf
index 4510e12..d5086ac 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -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')