Skip to content

Commit

Permalink
Code updated based on review comments.
Browse files Browse the repository at this point in the history
Features: control telemetry

Required-githooks: true

Signed-off-by: Samir Raval <[email protected]>
  • Loading branch information
ravalsam committed Dec 13, 2024
1 parent ca672e7 commit f67aed2
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/control/lib/control/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type httpReq struct {
url *url.URL
getFn httpGetFn
allowInsecure bool
cacertpath *string
httpsException bool
getBodyFn func(context.Context, *url.URL, httpGetFn, time.Duration, bool, bool) ([]byte, error)
}
Expand Down
15 changes: 8 additions & 7 deletions src/tests/ftest/config_file_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
import sys
from argparse import ArgumentParser, RawDescriptionHelpFormatter

from util.agent_utils_params import (DaosAgentTelemetryConfig, DaosAgentTransportCredentials,
from util.agent_utils_params import (DaosAgentTelemetryCredentials, DaosAgentTransportCredentials,
DaosAgentYamlParameters)
from util.command_utils_base import CommonConfig
from util.dmg_utils_params import DmgTelemetryConfig, DmgTransportCredentials, DmgYamlParameters
from util.dmg_utils_params import (DmgTelemetryCredentials, DmgTransportCredentials,
DmgYamlParameters)
from util.exception_utils import CommandFailure
from util.server_utils_params import (DaosServerTelemetryConfig, DaosServerTransportCredentials,
DaosServerYamlParameters)
from util.server_utils_params import (DaosServerTelemetryCredentials,
DaosServerTransportCredentials, DaosServerYamlParameters)


def generate_agent_config(args):
Expand All @@ -33,7 +34,7 @@ def generate_agent_config(args):
"""
common_cfg = CommonConfig(args.group_name, DaosAgentTransportCredentials())
config = DaosAgentYamlParameters(args.agent_file, common_cfg)
config.telemetry_config = DaosAgentTelemetryConfig()
config.telemetry_config = DaosAgentTelemetryCredentials()
# Update the configuration file access points
config.other_params.access_points.value = args.node_list.split(",")
return create_config(args, config)
Expand All @@ -51,7 +52,7 @@ def generate_server_config(args):
"""
common_cfg = CommonConfig(args.group_name, DaosServerTransportCredentials())
config = DaosServerYamlParameters(args.server_file, common_cfg)
config.telemetry_config = DaosServerTelemetryConfig()
config.telemetry_config = DaosServerTelemetryCredentials()
config.engine_params[0].storage.storage_tiers[0].storage_class.value = "ram"
config.engine_params[0].storage.storage_tiers[0].scm_mount.value = "/mnt/daos"
config.engine_params[0].storage.storage_tiers[0].scm_size.value = 0
Expand All @@ -72,7 +73,7 @@ def generate_dmg_config(args):
"""
config = DmgYamlParameters(
args.dmg_file, args.group_name, DmgTransportCredentials())
config.telemetry_config = DmgTelemetryConfig()
config.telemetry_config = DmgTelemetryCredentials()
# Update the configuration file hostlist
config.hostlist.value = args.node_list.split(",")
return create_config(args, config)
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/server/storage_tiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import yaml
from apricot import TestWithServers
from command_utils_base import CommonConfig
from server_utils import (DaosServerTelemetryConfig, DaosServerTransportCredentials,
from server_utils import (DaosServerTelemetryCredentials, DaosServerTransportCredentials,
DaosServerYamlParameters)


Expand Down Expand Up @@ -68,7 +68,7 @@ def test_tiers(self):

common_config = CommonConfig("daos_server", DaosServerTransportCredentials())
config = DaosServerYamlParameters(None, common_config)
config.telemetry_config = DaosServerTelemetryConfig()
config.telemetry_config = DaosServerTelemetryCredentials()
config.namespace = self.server_config_namespace
config.get_params(self)
data = config.get_yaml_data()
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/util/agent_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import socket

from agent_utils_params import (DaosAgentTelemetryConfig, DaosAgentTransportCredentials,
from agent_utils_params import (DaosAgentTelemetryCredentials, DaosAgentTransportCredentials,
DaosAgentYamlParameters)
from ClusterShell.NodeSet import NodeSet
from command_utils import CommandWithSubCommand, SubprocessManager, YamlCommand
Expand Down Expand Up @@ -54,7 +54,7 @@ def get_agent_command(group, cert_dir, bin_dir, config_file, run_user, config_te
transport_config = DaosAgentTransportCredentials(cert_dir)
common_config = CommonConfig(group, transport_config)
config = DaosAgentYamlParameters(config_file, common_config)
config.telemetry_config = DaosAgentTelemetryConfig(cert_dir)
config.telemetry_config = DaosAgentTelemetryCredentials(cert_dir)
command = DaosAgentCommand(bin_dir, config, run_user=run_user)
if config_temp:
# Setup the DaosAgentCommand to write the config file data to the
Expand Down
10 changes: 5 additions & 5 deletions src/tests/ftest/util/agent_utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import os

from command_utils_base import (BasicParameter, LogParameter, TelemetryConfig,
from command_utils_base import (BasicParameter, LogParameter, TelemetryCredentials,
TransportCredentials, YamlParameters)


Expand Down Expand Up @@ -33,12 +33,12 @@ def _get_new(self):
return DaosAgentTransportCredentials(self._log_dir)


class DaosAgentTelemetryConfig(TelemetryConfig):
class DaosAgentTelemetryCredentials(TelemetryCredentials):
# pylint: disable=too-few-public-methods
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, log_dir=os.path.join(os.sep, "tmp")):
"""Initialize a TelemetryConfig object."""
"""Initialize a TelemetryCredentials object."""
super().__init__("/run/agent_config/telemetry_config/*", None, log_dir)

self.telemetry_port = BasicParameter(None, 9192)
Expand All @@ -51,9 +51,9 @@ def _get_new(self):
"""Get a new object based upon this one.
Returns:
DaosServerTelemetryConfig: a new DaosServerTelemetryConfig object
DaosServerTelemetryCredentials: a new DaosServerTelemetryCredentials object
"""
return DaosAgentTelemetryConfig(self._log_dir)
return DaosAgentTelemetryCredentials(self._log_dir)


class DaosAgentYamlParameters(YamlParameters):
Expand Down
8 changes: 4 additions & 4 deletions src/tests/ftest/util/command_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,11 +799,11 @@ def _get_new(self):
return TransportCredentials(self.namespace, self.title, self._log_dir)


class TelemetryConfig(YamlParameters):
class TelemetryCredentials(YamlParameters):
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, namespace, title, log_dir):
"""Initialize a TelemetryConfig object.
"""Initialize a TelemetryCredentials object.
Args:
namespace (str): yaml namespace (path to parameters)
Expand Down Expand Up @@ -864,9 +864,9 @@ def _get_new(self):
"""Get a new object based upon this one.
Returns:
TelemetryConfig: a new TelemetryConfig object
TelemetryCredentials: a new TelemetryCredentials object
"""
return TelemetryConfig(self.namespace, self.title, self._log_dir)
return TelemetryCredentials(self.namespace, self.title, self._log_dir)


class CommonConfig(YamlParameters):
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/util/dmg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pwd import getpwuid

from dmg_utils_base import DmgCommandBase
from dmg_utils_params import DmgTelemetryConfig, DmgTransportCredentials, DmgYamlParameters
from dmg_utils_params import DmgTelemetryCredentials, DmgTransportCredentials, DmgYamlParameters
from exception_utils import CommandFailure
from general_utils import dict_to_str, get_numeric_list

Expand Down Expand Up @@ -39,7 +39,7 @@ def get_dmg_command(group, cert_dir, bin_dir, config_file, config_temp=None, hos
"""
transport_config = DmgTransportCredentials(cert_dir)
telemetry_config = DmgTelemetryConfig(cert_dir)
telemetry_config = DmgTelemetryCredentials(cert_dir)
config = DmgYamlParameters(config_file, group, transport_config, telemetry_config)
command = DmgCommand(bin_dir, config, hostlist_suffix)
if config_temp:
Expand Down
12 changes: 6 additions & 6 deletions src/tests/ftest/util/dmg_utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
"""

from command_utils_base import (BasicParameter, LogParameter, TelemetryConfig,
from command_utils_base import (BasicParameter, LogParameter, TelemetryCredentials,
TransportCredentials, YamlParameters)


Expand All @@ -26,21 +26,21 @@ def _get_new(self):
return DmgTransportCredentials(self._log_dir)


class DmgTelemetryConfig(TelemetryConfig):
class DmgTelemetryCredentials(TelemetryCredentials):
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, log_dir="/tmp"):
"""Initialize a TelemetryConfig object."""
"""Initialize a TelemetryCredentials object."""
super().__init__("/run/dmg/telemetry_config/*", None, log_dir)
self.https_exception = BasicParameter(None, True)

def _get_new(self):
"""Get a new object based upon this one.
Returns:
DmgTelemetryConfig: a new DmgTelemetryConfig object
DmgTelemetryCredentials: a new DmgTelemetryCredentials object
"""
return DmgTelemetryConfig(self._log_dir)
return DmgTelemetryCredentials(self._log_dir)


class DmgYamlParameters(YamlParameters):
Expand All @@ -54,7 +54,7 @@ def __init__(self, filename, name, transport, telemetry=None):
name (str): The DAOS system name.
transport (DmgTransportCredentials): dmg security
configuration settings.
telemetry (DmgTelemetryConfig): dmg telemetry
telemetry (DmgTelemetryCredentials): dmg telemetry
configuration settings.
"""
super().__init__("/run/dmg/*", filename, None, transport)
Expand Down
1 change: 0 additions & 1 deletion src/tests/ftest/util/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,6 @@ def _generate_certs(self, logger):
message = "Error generating certificates"
self.test_result.fail_test(logger, "Prepare", message, sys.exc_info())
return 128

return 0

def _collect_crash_files(self, logger):
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/util/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from host_utils import get_local_host
from run_utils import run_remote, stop_processes
from server_utils_base import DaosServerCommand, DaosServerInformation, ServerFailed
from server_utils_params import (DaosServerTelemetryConfig, DaosServerTransportCredentials,
from server_utils_params import (DaosServerTelemetryCredentials, DaosServerTransportCredentials,
DaosServerYamlParameters)
from user_utils import get_chown_command

Expand All @@ -46,7 +46,7 @@ def get_server_command(group, cert_dir, bin_dir, config_file, config_temp=None):
transport_config = DaosServerTransportCredentials(cert_dir)
common_config = CommonConfig(group, transport_config)
config = DaosServerYamlParameters(config_file, common_config)
config.telemetry_config = DaosServerTelemetryConfig(cert_dir)
config.telemetry_config = DaosServerTelemetryCredentials(cert_dir)

command = DaosServerCommand(bin_dir, config, None)

Expand Down
10 changes: 5 additions & 5 deletions src/tests/ftest/util/server_utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import os

from command_utils_base import (BasicParameter, LogParameter, TelemetryConfig,
from command_utils_base import (BasicParameter, LogParameter, TelemetryCredentials,
TransportCredentials, YamlParameters)

MAX_STORAGE_TIERS = 5
Expand Down Expand Up @@ -57,12 +57,12 @@ def _get_new(self):
return DaosServerTransportCredentials(self._log_dir)


class DaosServerTelemetryConfig(TelemetryConfig):
class DaosServerTelemetryCredentials(TelemetryCredentials):
# pylint: disable=too-few-public-methods
"""Telemetry credentials listing certificates for secure communication."""

def __init__(self, log_dir=os.path.join(os.sep, "tmp")):
"""Initialize a DaosServerTelemetryConfig object."""
"""Initialize a DaosServerTelemetryCredentials object."""
super().__init__("/run/server_config/telemetry_config/*", None, log_dir)

# Additional daos_server telemetry credential parameters:
Expand All @@ -78,9 +78,9 @@ def _get_new(self):
"""Get a new object based upon this one.
Returns:
DaosServerTelemetryConfig: a new DaosServerTelemetryConfig object
DaosServerTelemetryCredentials: a new DaosServerTelemetryCredentials object
"""
return DaosServerTelemetryConfig(self._log_dir)
return DaosServerTelemetryCredentials(self._log_dir)


class DaosServerYamlParameters(YamlParameters):
Expand Down

0 comments on commit f67aed2

Please sign in to comment.