From: Douglas Bagnall Date: Mon, 22 Oct 2018 21:30:46 +0000 (+1300) Subject: traffic_replay: --old-scale to mimic the old traffic_replay X-Git-Tag: tdb-1.3.17~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=affaeb944fd77ea67d6fb9ece2c53e6433e3b4a7;p=thirdparty%2Fsamba.git traffic_replay: --old-scale to mimic the old traffic_replay 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 Reviewed-by: Andrew Bartlett --- 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 index 00000000000..3c9b4e7c71c --- /dev/null +++ b/python/samba/tests/blackbox/testdata/traffic_replay-3.expected @@ -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 diff --git a/python/samba/tests/blackbox/traffic_replay.py b/python/samba/tests/blackbox/traffic_replay.py index 8370939d243..a84d1a423e4 100644 --- a/python/samba/tests/blackbox/traffic_replay.py +++ b/python/samba/tests/blackbox/traffic_replay.py @@ -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, diff --git a/script/traffic_replay b/script/traffic_replay index a02539ffa73..c864c540d10 100755 --- a/script/traffic_replay +++ b/script/traffic_replay @@ -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()