From bb6c4dbe0796e43d5a4fe71b9d5318d4d97e077d Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Mon, 3 May 2021 15:55:43 -0500 Subject: [PATCH 1/9] add support for DNS tests --- .../cloudharmony_network_benchmark.py | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 16f3fd5835..c47fe07d21 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -47,6 +47,7 @@ # network test service types COMPUTE = 'compute' STORAGE = 'storage' +DNS = 'dns' # network compute server type NGINX = 'nginx' # tests accepted by the --test flag of the gartner network benchmark @@ -57,7 +58,7 @@ # tcp: rtt, ssl, ttfb NETWORK_TESTS = ['latency', 'downlink', 'uplink', 'dns', 'rtt', 'ssl', 'ttfb'] -flags.DEFINE_enum('ch_network_test_service_type', COMPUTE, [COMPUTE, STORAGE], +flags.DEFINE_enum('ch_network_test_service_type', COMPUTE, [COMPUTE, STORAGE, DNS], 'The service type to host the website.') flags.DEFINE_enum('ch_network_test', 'latency', NETWORK_TESTS, 'Test supported by CloudHarmony network benchmark as defined' @@ -110,6 +111,12 @@ def CheckPrerequisites(_): # TODO(user): add AWS & Azure support for object storage if FLAGS.ch_network_test_service_type == STORAGE and FLAGS.cloud != 'GCP': raise NotImplementedError('Benchmark only supports GCS object storage.') + elif FLAGS.ch_network_test_service_type == DNS and FLAGS.ch_network_test != 'dns': + raise InvalidConfigurationError('If ch_network_test_service_type flag is set to dns, ch_network_test flag must also be dns') + elif FLAGS.ch_network_test_service_type != DNS and FLAGS.ch_network_test == 'dns': + raise InvalidConfigurationError('If ch_network_test flag is set to dns, ch_network_test_service_type flag must also be dns') + elif FLAGS.ch_network_test_service_type == DNS and FLAGS.cloud != 'GCP': + raise NotImplementedError('DNS Benchmark not implemented for this cloud type') def GetConfig(user_config): @@ -229,6 +236,8 @@ def Prepare(benchmark_spec): vm_util.RunThreaded(_PrepareServer, vm_groups['server']) elif FLAGS.ch_network_test_service_type == STORAGE: _PrepareBucket(benchmark_spec) + elif FLAGS.ch_network_test_service_type == DNS: + pass else: raise NotImplementedError() @@ -306,6 +315,15 @@ def _Run(benchmark_spec, test): http_url = f'http://{benchmark_spec.bucket}.storage.googleapis.com/probe' endpoints = f'--test_endpoint={http_url}' _AddStorageMetadata(client, metadata) + elif FLAGS.ch_network_test_service_type == DNS: + vms = vm_groups['server'] + # use GCP zonal internal DNS, but maybe should add domain to vm's data attributes? + endpoints = '' + if FLAGS.cloud == 'GCP': + endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) + else: + raise NotImplementedError('DNS not implemented for this cloud type') + _AddComputeMetadata(client, vms[0], metadata) if FLAGS.ch_network_throughput_https: metadata['throughput_https'] = True @@ -315,6 +333,8 @@ def _Run(benchmark_spec, test): metadata['throughput_time'] = True if FLAGS.ch_network_throughput_slowest_thread: metadata['throughput_slowest_thread'] = True + if FLAGS.ch_network_test == 'dns': + metadata['dns_recursive'] = True metadata = cloud_harmony_util.GetCommonMetadata(metadata) cmd_path = posixpath.join(cloud_harmony_network.INSTALL_PATH, 'run.sh') From bbd4bd45086a5bd0072306cd42fd651d56eab658 Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Mon, 13 Dec 2021 14:04:34 -0800 Subject: [PATCH 2/9] update error --- .../linux_benchmarks/cloudharmony_network_benchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index c47fe07d21..46ab23b59f 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -112,9 +112,9 @@ def CheckPrerequisites(_): if FLAGS.ch_network_test_service_type == STORAGE and FLAGS.cloud != 'GCP': raise NotImplementedError('Benchmark only supports GCS object storage.') elif FLAGS.ch_network_test_service_type == DNS and FLAGS.ch_network_test != 'dns': - raise InvalidConfigurationError('If ch_network_test_service_type flag is set to dns, ch_network_test flag must also be dns') + raise errors.Setup.InvalidConfigurationError('If ch_network_test_service_type flag is set to dns, ch_network_test flag must also be dns') elif FLAGS.ch_network_test_service_type != DNS and FLAGS.ch_network_test == 'dns': - raise InvalidConfigurationError('If ch_network_test flag is set to dns, ch_network_test_service_type flag must also be dns') + raise errors.Setup.InvalidConfigurationError('If ch_network_test flag is set to dns, ch_network_test_service_type flag must also be dns') elif FLAGS.ch_network_test_service_type == DNS and FLAGS.cloud != 'GCP': raise NotImplementedError('DNS Benchmark not implemented for this cloud type') From a0a816074fc6c325abf4e848dda6f3e42b79027e Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Mon, 13 Dec 2021 15:42:20 -0800 Subject: [PATCH 3/9] correct metadata info for ttfb, ssl, rtt tests --- .../linux_benchmarks/cloudharmony_network_benchmark.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 46ab23b59f..ad88432838 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -320,7 +320,8 @@ def _Run(benchmark_spec, test): # use GCP zonal internal DNS, but maybe should add domain to vm's data attributes? endpoints = '' if FLAGS.cloud == 'GCP': - endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) + # endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) + endpoints = ' '.join('--test_endpoint=google.com') else: raise NotImplementedError('DNS not implemented for this cloud type') _AddComputeMetadata(client, vms[0], metadata) @@ -335,11 +336,15 @@ def _Run(benchmark_spec, test): metadata['throughput_slowest_thread'] = True if FLAGS.ch_network_test == 'dns': metadata['dns_recursive'] = True + if FLAGS.ch_network_test in ['rtt', 'ssl', 'ttfb']: + metadata['throughput_time'] = True metadata = cloud_harmony_util.GetCommonMetadata(metadata) cmd_path = posixpath.join(cloud_harmony_network.INSTALL_PATH, 'run.sh') outdir = vm_util.VM_TMP_DIR cmd = f'sudo {cmd_path} {endpoints} {metadata} --output={outdir} --verbose' + print("CMD") + print(cmd) client.RobustRemoteCommand(cmd) save_command = posixpath.join(cloud_harmony_network.INSTALL_PATH, 'save.sh') client.RemoteCommand(f'{save_command} {outdir}') From d87309a29c9e6e39fe4f58eb12b228099a62192e Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Tue, 28 Dec 2021 17:00:30 -0600 Subject: [PATCH 4/9] ssl fix --- .../cloudharmony_network_benchmark.py | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index ad88432838..7de9842571 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -154,6 +154,27 @@ def _PrepareServer(vm): vm.RemoteCommand( 'sudo sed -i "/server_name _;/a client_max_body_size 100M;" /etc/nginx/sites-enabled/default' ) + + # Required for SSL test. Have to make self signed certificate and setup SSL config for nginx + vm.RemoteCommand('sudo openssl rand -writerand .rnd') + vm.RemoteCommand( + f'sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj ' + f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' + f'-keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt ' + ) + vm.RemoteCommand('sudo openssl dhparam -out /etc/nginx/dhparam.pem 1024') + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a listen 443 ssl default_server;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a listen [::]:443 ssl default_server;" /etc/nginx/sites-enabled/default' + ) vm.RemoteCommand('sudo systemctl restart nginx') web_probe_file = posixpath.join(vm.GetScratchDir(), 'probe.tgz') @@ -232,6 +253,10 @@ def Prepare(benchmark_spec): vm_groups = benchmark_spec.vm_groups client = vm_groups['client'][0] client.Install('cloud_harmony_network') + + if FLAGS.ch_network_test == 'ssl': + client.RemoteCommand('echo insecure >> $HOME/.curlrc') + if FLAGS.ch_network_test_service_type == COMPUTE: vm_util.RunThreaded(_PrepareServer, vm_groups['server']) elif FLAGS.ch_network_test_service_type == STORAGE: @@ -320,8 +345,7 @@ def _Run(benchmark_spec, test): # use GCP zonal internal DNS, but maybe should add domain to vm's data attributes? endpoints = '' if FLAGS.cloud == 'GCP': - # endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) - endpoints = ' '.join('--test_endpoint=google.com') + endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) else: raise NotImplementedError('DNS not implemented for this cloud type') _AddComputeMetadata(client, vms[0], metadata) @@ -343,8 +367,6 @@ def _Run(benchmark_spec, test): cmd_path = posixpath.join(cloud_harmony_network.INSTALL_PATH, 'run.sh') outdir = vm_util.VM_TMP_DIR cmd = f'sudo {cmd_path} {endpoints} {metadata} --output={outdir} --verbose' - print("CMD") - print(cmd) client.RobustRemoteCommand(cmd) save_command = posixpath.join(cloud_harmony_network.INSTALL_PATH, 'save.sh') client.RemoteCommand(f'{save_command} {outdir}') From e6b6c3aa8bc40cc9ddecd944d7f74ad4c78020b0 Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Tue, 4 Jan 2022 11:04:51 -0600 Subject: [PATCH 5/9] add unencrypted option --- .../cloudharmony_network_benchmark.py | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 7de9842571..7014fb394d 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -58,6 +58,12 @@ # tcp: rtt, ssl, ttfb NETWORK_TESTS = ['latency', 'downlink', 'uplink', 'dns', 'rtt', 'ssl', 'ttfb'] +# SSL encryption types +RSA = 'rsa' +ECC = 'ecc' +UNENCRYPTED = 'unencrypted' + + flags.DEFINE_enum('ch_network_test_service_type', COMPUTE, [COMPUTE, STORAGE, DNS], 'The service type to host the website.') flags.DEFINE_enum('ch_network_test', 'latency', NETWORK_TESTS, @@ -88,6 +94,8 @@ 'threads.') flags.DEFINE_integer('ch_network_tcp_samples', 10, 'The number of test samples ' 'for TCP tests (rtt, ssl or ttfb).') +flags.DEFINE_enum('ch_ssl_encryption_type', ECC, [ECC, RSA, UNENCRYPTED], + 'Encryption type to use for SSL.') CLIENT_ZONE = flags.DEFINE_string( 'ch_client_zone', None, 'zone to launch the network or storage test client in. ') @@ -155,27 +163,42 @@ def _PrepareServer(vm): 'sudo sed -i "/server_name _;/a client_max_body_size 100M;" /etc/nginx/sites-enabled/default' ) - # Required for SSL test. Have to make self signed certificate and setup SSL config for nginx + # Required for SSL test + # Generate random vm.RemoteCommand('sudo openssl rand -writerand .rnd') - vm.RemoteCommand( - f'sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj ' - f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' - f'-keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt ' - ) - vm.RemoteCommand('sudo openssl dhparam -out /etc/nginx/dhparam.pem 1024') - vm.RemoteCommand( - 'sudo sed -i "/server_name _;/a ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;" /etc/nginx/sites-enabled/default' - ) - vm.RemoteCommand( - 'sudo sed -i "/server_name _;/a ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" /etc/nginx/sites-enabled/default' - ) - vm.RemoteCommand( - 'sudo sed -i "/server_name _;/a listen 443 ssl default_server;" /etc/nginx/sites-enabled/default' - ) - vm.RemoteCommand( - 'sudo sed -i "/server_name _;/a listen [::]:443 ssl default_server;" /etc/nginx/sites-enabled/default' - ) - vm.RemoteCommand('sudo systemctl restart nginx') + + # Create self signed certificate (RSA) + if FLAGS.ch_ssl_encryption_type == RSA: + vm.RemoteCommand( + f'sudo openssl req -x509 -nodes -days 1 -newkey rsa:2048 -subj ' + f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' + f'-keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt ' + ) + # Create self signed certificate (ECC) + elif FLAGS.ch_ssl_encryption_type == ECC: + vm.RemoteCommand('sudo openssl ecparam -genkey -name prime256v1 -out /etc/ssl/private/nginx-selfsigned.key') + vm.RemoteCommand( + f'sudo openssl req -new -x509 -days 365 -extensions v3_ca -key /etc/ssl/private/nginx-selfsigned.key -subj ' + f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' + f'-out /etc/ssl/certs/nginx-selfsigned.crt ' + ) + if FLAGS.ch_ssl_encryption_type != UNENCRYPTED: + # Setup SSL config for nginx + vm.RemoteCommand('sudo openssl dhparam -out /etc/nginx/dhparam.pem 1024') + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a listen 443 ssl default_server;" /etc/nginx/sites-enabled/default' + ) + vm.RemoteCommand( + 'sudo sed -i "/server_name _;/a listen [::]:443 ssl default_server;" /etc/nginx/sites-enabled/default' + ) + + vm.RemoteCommand('sudo systemctl restart nginx') web_probe_file = posixpath.join(vm.GetScratchDir(), 'probe.tgz') vm.InstallPreprovisionedPackageData(cloud_harmony_network.PACKAGE_NAME, From 4795fe2e52222b591aebae4715210a3c5395cc7a Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Tue, 4 Jan 2022 11:29:51 -0600 Subject: [PATCH 6/9] add additional comments --- .../linux_benchmarks/cloudharmony_network_benchmark.py | 1 + 1 file changed, 1 insertion(+) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 7014fb394d..e542c2c2d6 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -277,6 +277,7 @@ def Prepare(benchmark_spec): client = vm_groups['client'][0] client.Install('cloud_harmony_network') + # Ignore complaints from using self-signed certificate if FLAGS.ch_network_test == 'ssl': client.RemoteCommand('echo insecure >> $HOME/.curlrc') From c8f42603c5022a253f48c0d9f3206520a22afdae Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Tue, 4 Jan 2022 11:31:34 -0600 Subject: [PATCH 7/9] fix bug --- .../linux_benchmarks/cloudharmony_network_benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index e542c2c2d6..8435090f02 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -198,7 +198,7 @@ def _PrepareServer(vm): 'sudo sed -i "/server_name _;/a listen [::]:443 ssl default_server;" /etc/nginx/sites-enabled/default' ) - vm.RemoteCommand('sudo systemctl restart nginx') + vm.RemoteCommand('sudo systemctl restart nginx') web_probe_file = posixpath.join(vm.GetScratchDir(), 'probe.tgz') vm.InstallPreprovisionedPackageData(cloud_harmony_network.PACKAGE_NAME, From adb36c094327154553602c43339bc01433948b12 Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Thu, 6 Jan 2022 15:52:35 -0600 Subject: [PATCH 8/9] make enum class. Remove extra check. Combine two error statements --- .../cloudharmony_network_benchmark.py | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 8435090f02..2d8bf5e48d 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -15,6 +15,7 @@ import logging import posixpath +import enum from absl import flags from perfkitbenchmarker import cloud_harmony_util @@ -56,12 +57,13 @@ # tests as defined below # throughput: downlink, uplink # tcp: rtt, ssl, ttfb -NETWORK_TESTS = ['latency', 'downlink', 'uplink', 'dns', 'rtt', 'ssl', 'ttfb'] +NETWORK_TESTS = ['latency', 'downlink', 'uplink', 'rtt', 'ssl', 'ttfb', DNS] -# SSL encryption types -RSA = 'rsa' -ECC = 'ecc' -UNENCRYPTED = 'unencrypted' +# TLS encryption types +class TlsEncryptionType(enum.Enum): + RSA = 'rsa' + ECC = 'ecc' + UNENCRYPTED = 'unencrypted' flags.DEFINE_enum('ch_network_test_service_type', COMPUTE, [COMPUTE, STORAGE, DNS], @@ -94,7 +96,7 @@ 'threads.') flags.DEFINE_integer('ch_network_tcp_samples', 10, 'The number of test samples ' 'for TCP tests (rtt, ssl or ttfb).') -flags.DEFINE_enum('ch_ssl_encryption_type', ECC, [ECC, RSA, UNENCRYPTED], +flags.DEFINE_enum_class('ch_ssl_encryption_type', TlsEncryptionType.ECC, TlsEncryptionType, 'Encryption type to use for SSL.') CLIENT_ZONE = flags.DEFINE_string( 'ch_client_zone', None, @@ -119,10 +121,9 @@ def CheckPrerequisites(_): # TODO(user): add AWS & Azure support for object storage if FLAGS.ch_network_test_service_type == STORAGE and FLAGS.cloud != 'GCP': raise NotImplementedError('Benchmark only supports GCS object storage.') - elif FLAGS.ch_network_test_service_type == DNS and FLAGS.ch_network_test != 'dns': - raise errors.Setup.InvalidConfigurationError('If ch_network_test_service_type flag is set to dns, ch_network_test flag must also be dns') - elif FLAGS.ch_network_test_service_type != DNS and FLAGS.ch_network_test == 'dns': - raise errors.Setup.InvalidConfigurationError('If ch_network_test flag is set to dns, ch_network_test_service_type flag must also be dns') + elif [FLAGS.ch_network_test_service_type, FLAGS.ch_network_test].count(DNS) == 1: + raise errors.Setup.InvalidConfigurationError('To perform DNS test, both ch_network_test flag and ' + 'ch_network_test_service_type flag must be set to dns') elif FLAGS.ch_network_test_service_type == DNS and FLAGS.cloud != 'GCP': raise NotImplementedError('DNS Benchmark not implemented for this cloud type') @@ -168,21 +169,21 @@ def _PrepareServer(vm): vm.RemoteCommand('sudo openssl rand -writerand .rnd') # Create self signed certificate (RSA) - if FLAGS.ch_ssl_encryption_type == RSA: + if FLAGS.ch_ssl_encryption_type == TlsEncryptionType.RSA: vm.RemoteCommand( f'sudo openssl req -x509 -nodes -days 1 -newkey rsa:2048 -subj ' f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' f'-keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt ' ) # Create self signed certificate (ECC) - elif FLAGS.ch_ssl_encryption_type == ECC: + elif FLAGS.ch_ssl_encryption_type == TlsEncryptionType.ECC: vm.RemoteCommand('sudo openssl ecparam -genkey -name prime256v1 -out /etc/ssl/private/nginx-selfsigned.key') vm.RemoteCommand( f'sudo openssl req -new -x509 -days 365 -extensions v3_ca -key /etc/ssl/private/nginx-selfsigned.key -subj ' f'"/C=NA/ST=NA/L=NA/O=PerfKitBenchmarker/CN={vm.internal_ip}" ' f'-out /etc/ssl/certs/nginx-selfsigned.crt ' ) - if FLAGS.ch_ssl_encryption_type != UNENCRYPTED: + if FLAGS.ch_ssl_encryption_type != TlsEncryptionType.UNENCRYPTED: # Setup SSL config for nginx vm.RemoteCommand('sudo openssl dhparam -out /etc/nginx/dhparam.pem 1024') vm.RemoteCommand( @@ -367,11 +368,7 @@ def _Run(benchmark_spec, test): elif FLAGS.ch_network_test_service_type == DNS: vms = vm_groups['server'] # use GCP zonal internal DNS, but maybe should add domain to vm's data attributes? - endpoints = '' - if FLAGS.cloud == 'GCP': - endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) - else: - raise NotImplementedError('DNS not implemented for this cloud type') + endpoints = ' '.join([f'--test_endpoint={vm.name}.{vm.zone}.c.{vm.project}.internal' for vm in vms]) _AddComputeMetadata(client, vms[0], metadata) if FLAGS.ch_network_throughput_https: From 6c531025f5447149449e3401414cf52587f83052 Mon Sep 17 00:00:00 2001 From: Derek Phanekham Date: Thu, 6 Jan 2022 16:21:02 -0600 Subject: [PATCH 9/9] change one more dns to enum --- .../linux_benchmarks/cloudharmony_network_benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py index 2d8bf5e48d..1ce5ca6f5b 100644 --- a/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py +++ b/perfkitbenchmarker/linux_benchmarks/cloudharmony_network_benchmark.py @@ -379,7 +379,7 @@ def _Run(benchmark_spec, test): metadata['throughput_time'] = True if FLAGS.ch_network_throughput_slowest_thread: metadata['throughput_slowest_thread'] = True - if FLAGS.ch_network_test == 'dns': + if FLAGS.ch_network_test == DNS: metadata['dns_recursive'] = True if FLAGS.ch_network_test in ['rtt', 'ssl', 'ttfb']: metadata['throughput_time'] = True