traffic_replay: --old-scale to mimic the old traffic_replay
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 22 Oct 2018 21:30:46 +0000 (10:30 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 8 Jan 2019 22:55:34 +0000 (23:55 +0100)
traffic_replay had a broken sense of traffic scale. That is fixed, but
in order to compare old and new tests, it helps to be able to
approximate the old behaviour.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/blackbox/testdata/traffic_replay-3.expected [new file with mode: 0644]
python/samba/tests/blackbox/traffic_replay.py
script/traffic_replay

diff --git a/python/samba/tests/blackbox/testdata/traffic_replay-3.expected b/python/samba/tests/blackbox/testdata/traffic_replay-3.expected
new file mode 100644 (file)
index 0000000..3c9b4e7
--- /dev/null
@@ -0,0 +1,11 @@
+0.011388       06              2       1       ldap    3       searchRequest   2       DC,DC           cn                      
+0.221447       06              2       1       ldap    2       unbindRequest                                                   
+0.460878       06              3       1       ldap    3       searchRequest   2       DC,DC           cn                      
+0.581933       11              4       1       cldap   3       searchRequest                           Netlogon                        
+0.596977       11              4       1       cldap   3       searchRequest                           Netlogon                        
+0.611184       11              4       1       cldap   3       searchRequest                           Netlogon                        
+0.666808       06              3       1       ldap    2       unbindRequest                                                   
+0.744297       06              4       1       rpc_netlogon    29      NetrLogonGetDomainInfo  
+0.768994       06              4       1       kerberos                        
+0.772476       06              4       1       ldap    3       searchRequest   2       DC,DC           cn                      
+0.865384       06              5       1       ldap    3       searchRequest                           subschemaSubentry,dsServiceName,namingContexts,defaultNamingContext,schemaNamingContext,configurationNamingContext,rootDomainNamingContext,supportedControl,supportedLDAPVersion,supportedLDAPPolicies,supportedSASLMechanisms,dnsHostName,ldapServiceName,serverName,supportedCapabilities                     
index 8370939d243db5a25949117bbc554ae0c96aa76f..a84d1a423e4e6c220c1e2e737b504f220e451855 100644 (file)
@@ -72,6 +72,9 @@ class TrafficLearnerTests(BlackboxTestCase):
                                   ["--random-seed=4"],
                                   ["--random-seed=3",
                                    "--conversation-persistence=0.5"],
+                                  ["--random-seed=3",
+                                   "--old-scale",
+                                   "--conversation-persistence=0.95"],
                                   )):
             with temp_file(self.tempdir) as output:
                 command = ([SCRIPT, MODEL,
index a02539ffa7328f7373ca3985a05391074ad71b7f..c864c540d1083edacad99c782d8d54c237784b54 100755 (executable)
@@ -81,6 +81,9 @@ def main():
     model_group.add_option('-S', '--scale-traffic', type='float', default=1.0,
                            help='Increase the number of conversations by '
                            'this factor')
+    parser.add_option('--old-scale',
+                      action="store_true",
+                      help='emulate the old scale for traffic')
     model_group.add_option('-D', '--duration', type='float', default=60.0,
                            help=('Run model for this long (approx). '
                                  'Default 60s for models'))
@@ -245,6 +248,13 @@ def main():
                               "(%s) is not writable" % opts.traffic_summary))
             sys.exit()
 
+    if opts.old_scale:
+        # we used to use a silly calculation based on the number
+        # of conversations; now we use the number of packets and
+        # scale traffic accurately. To roughly compare with older
+        # numbers you use --old-scale which approximates as follows:
+        opts.scale_traffic *= 0.55
+
     # ingest the model
     if model_file and not opts.generate_users_only:
         model = traffic.TrafficModel()