From 20850d6599fb4e953ea59202e07d6c33f8e1f3db Mon Sep 17 00:00:00 2001 From: Konstantin Yarovoy Date: Tue, 6 Aug 2024 21:46:18 +0000 Subject: [PATCH] config: introduce new config format and parser For supporting multiple deployments in one cnf and improving overall config usability and structure - new config format has to be introduced. This change does not replace the old config format. Refs: #2121 Signed-off-by: Konstantin Yarovoy --- embedded_files/cnf-testsuite-v2-example.yml | 20 ++ src/tasks/setup.cr | 8 + src/tasks/utils/cnf_installation/config.cr | 195 ++++++++++++++++++ .../utils/cnf_installation/install_common.cr | 8 - src/tasks/utils/cnf_manager.cr | 29 ++- src/tasks/utils/config.cr | 51 ++--- src/tasks/utils/task.cr | 5 - src/tasks/workload/compatibility.cr | 9 +- src/tasks/workload/configuration.cr | 2 +- src/tasks/workload/microservice.cr | 7 +- src/tasks/workload/observability.cr | 1 - src/tasks/workload/ran.cr | 3 +- 12 files changed, 265 insertions(+), 73 deletions(-) create mode 100644 embedded_files/cnf-testsuite-v2-example.yml create mode 100644 src/tasks/utils/cnf_installation/config.cr diff --git a/embedded_files/cnf-testsuite-v2-example.yml b/embedded_files/cnf-testsuite-v2-example.yml new file mode 100644 index 000000000..472628c1a --- /dev/null +++ b/embedded_files/cnf-testsuite-v2-example.yml @@ -0,0 +1,20 @@ +--- +config_version: "v2" +common_parameters: + container_names: + - name: coredns + rolling_update_test_tag: "1.8.0" + rolling_downgrade_test_tag: 1.6.7 + rolling_version_change_test_tag: 1.8.0 + rollback_from_tag: 1.8.0 + +deployments: + helm_charts: + - name: coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable + helm_chart_name: coredns + helm_directories: + - name: envoy + helm_directory: ../example-cnfs/envoy/envoy/ + diff --git a/src/tasks/setup.cr b/src/tasks/setup.cr index bf2b9801b..d819a7e19 100644 --- a/src/tasks/setup.cr +++ b/src/tasks/setup.cr @@ -25,3 +25,11 @@ task "configuration_file_setup" do |_, args| CNFManager::Points.create_points_yml end +task "test_config" do |_, args| + if args.named["cfg"]? + puts CNFInstall::Config.parse_cnf_config_from_file(args.named["cfg"].to_s).inspect + else + stdout_failure "cfg parameter needed" + exit 1 + end +end diff --git a/src/tasks/utils/cnf_installation/config.cr b/src/tasks/utils/cnf_installation/config.cr new file mode 100644 index 000000000..0aa036722 --- /dev/null +++ b/src/tasks/utils/cnf_installation/config.cr @@ -0,0 +1,195 @@ +require "yaml" +require "../utils.cr" + +module CNFInstall + module Config + @[YAML::Serializable::Options(emit_nulls: true)] + + class ConfigBase + include YAML::Serializable + include YAML::Serializable::Strict + end + + class Config < ConfigBase + # TODO: remove as much parameters as possible + @config_version : String + @common_parameters : CommonParameters | Nil + @dynamic_parameters : DynamicParameters | Nil + @deployments : DeploymentsConfig + getter config_version, common_parameters, deployments + getter! dynamic_parameters + + def after_initialize + unless @dynamic_parameters + @dynamic_parameters = DynamicParameters.new() + end + end + end + + class CommonParameters < ConfigBase + @service_name : String | Nil + @rolling_update_tag : String | Nil + @container_names : Array(Hash(String, String)) | Nil + @white_list_container_names : Array(String) | Nil + @docker_insecure_registries : Array(String) | Nil + @image_registry_fqdns : Hash(String, String) | Nil + @five_g_parameters : FiveGParameters | Nil + getter service_name, rolling_update_tag, container_names, white_list_container_names + getter docker_insecure_registries, image_registry_fqdns, five_g_parameters + end + + class DynamicParameters < ConfigBase + @source_cnf_dir : String | Nil + @destination_cnf_dir : String | Nil + @install_method : Tuple(CNFInstall::InstallMethod, String) | Nil + property source_cnf_dir, destination_cnf_dir + property install_method + + def initialize() + end + end + + class DeploymentsConfig < ConfigBase + @helm_charts : Array(HelmChartConfig) = [] of HelmChartConfig + @helm_directories : Array(HelmDirectoryConfig) = [] of HelmDirectoryConfig + @manifests : Array(ManifestDirectoryConfig) = [] of ManifestDirectoryConfig + getter helm_charts, helm_directories, manifests + + def after_initialize + if @helm_charts.empty? && @helm_directories.empty? && @manifests.empty? + raise YAML::Error.new("At least one deployment should be configured") + end + + deployment_names = Set(String).new + {@helm_charts, @helm_directories, @manifests}.each do |deployment_array| + if deployment_array + deployment_array.each do |deployment| + if deployment_names.includes?(deployment.name) + raise YAML::Error.new("Deployment names should be unique: \"#{deployment.name}\"") + else + deployment_names.add(deployment.name) + end + end + end + end + end + end + + class DeploymentConfig < ConfigBase + @name : String + getter name + end + + class HelmChartConfig < DeploymentConfig + @helm_repo_name : String + @helm_repo_url : String + @helm_chart_name : String + @helm_values : String | Nil + @namespace : String | Nil + getter helm_repo_name, helm_repo_url, helm_chart_name, helm_values, namespace + end + + class HelmDirectoryConfig < DeploymentConfig + @helm_directory : String + @helm_values : String | Nil + @namespace : String | Nil + getter helm_directory, helm_values, namespace + end + + class ManifestDirectoryConfig < DeploymentConfig + @manifest_directory : String + getter manifest_directory + end + + class FiveGParameters < ConfigBase + @amf_label : String | Nil + @smf_label : String | Nil + @upf_label : String | Nil + @ric_label : String | Nil + @amf_service_name : String | Nil + @mmc : String | Nil + @mnc : String | Nil + @sst : String | Nil + @sd : String | Nil + @tac : String | Nil + @protectionScheme : String | Nil + @publicKey : String | Nil + @publicKeyId : String | Nil + @routingIndicator : String | Nil + @enabled : String | Nil + @count : String | Nil + @initialMSISDN : String | Nil + @key : String | Nil + @op : String | Nil + @opType : String | Nil + @type : String | Nil + @apn : String | Nil + @emergency : String | Nil + end + + def self.parse_cnf_config_from_file(path_to_config) + yaml_content = File.read(path_to_config) + config_dir = CNFManager.ensure_cnf_testsuite_dir(path_to_config) + begin + parse_cnf_config_from_yaml(yaml_content, config_dir) + rescue exception + stdout_failure "Error during parsing CNF config on #{path_to_config}" + stdout_failure exception.message + stdout_failure "Please check your config according to the config template." + exit 1 + end + end + + def self.parse_cnf_config_from_yaml(yaml_content, config_dir) + config = Config.from_yaml(yaml_content) + + unless config.dynamic_parameters.source_cnf_dir + config.dynamic_parameters.source_cnf_dir = config_dir + end + + unless config.dynamic_parameters.install_method + config.dynamic_parameters.install_method = get_install_method_from_deployments(config.deployments) + end + + unless config.dynamic_parameters.destination_cnf_dir + install_method = config.dynamic_parameters.install_method.not_nil![0] + case install_method + when CNFInstall::InstallMethod::HelmChart + deployment_name = config.deployments.helm_charts[0].name + when CNFInstall::InstallMethod::HelmDirectory + deployment_name = config.deployments.helm_directories[0].name + when CNFInstall::InstallMethod::ManifestDirectory + deployment_name = config.deployments.manifests[0].name + else + raise "Unknown install method: #{install_method}" + end + current_dir = FileUtils.pwd + config.dynamic_parameters.destination_cnf_dir = "#{current_dir}/#{CNF_DIR}/#{deployment_name}" + end + + config + end + + def self.get_install_method_from_deployments(deployments_config) + if !deployments_config.helm_charts.empty? + helm_chart_name = deployments_config.helm_charts[0].helm_chart_name + {CNFInstall::InstallMethod::HelmChart, helm_chart_name} + + elsif !deployments_config.helm_directories.empty? + helm_directory = deployments_config.helm_directories[0].helm_directory + deployment_name = deployments_config.helm_directories[0].name + full_helm_directory = Path[CNF_DIR + "/" + deployment_name + "/" + CNFManager.sandbox_helm_directory(helm_directory)].expand.to_s + {CNFInstall::InstallMethod::HelmDirectory, full_helm_directory} + + elsif !deployments_config.manifests.empty? + manifest_directory = deployments_config.manifests[0].manifest_directory + deployment_name = deployments_config.manifests[0].name + full_manifest_directory = Path[CNF_DIR + "/" + deployment_name + "/" + CNFManager.sandbox_helm_directory(manifest_directory)].expand.to_s + {CNFInstall::InstallMethod::ManifestDirectory, full_manifest_directory} + + else + raise YAML::Error.new("At least one deployment should be configured") + end + end + end +end diff --git a/src/tasks/utils/cnf_installation/install_common.cr b/src/tasks/utils/cnf_installation/install_common.cr index 351a0734a..41a51248a 100644 --- a/src/tasks/utils/cnf_installation/install_common.cr +++ b/src/tasks/utils/cnf_installation/install_common.cr @@ -29,14 +29,6 @@ module CNFInstall end end - def self.cnf_installation_method(config : CNFManager::Config) : Tuple(CNFInstall::InstallMethod, String) - Log.info { "cnf_installation_method config : CNFManager::Config" } - Log.info { "config_cnf_config: #{config.cnf_config}" } - yml_file_path = config.cnf_config[:source_cnf_file] - parsed_config_file = CNFManager.parsed_config_file(yml_file_path) - cnf_installation_method(parsed_config_file) - end - #Determine, for cnf, whether a helm chart, helm directory, or manifest directory is being used for installation def self.cnf_installation_method(config : Totem::Config) : Tuple(CNFInstall::InstallMethod, String) Log.info { "cnf_installation_method" } diff --git a/src/tasks/utils/cnf_manager.cr b/src/tasks/utils/cnf_manager.cr index c2d5dd0d7..819012b1c 100644 --- a/src/tasks/utils/cnf_manager.cr +++ b/src/tasks/utils/cnf_manager.cr @@ -74,17 +74,16 @@ module CNFManager def self.cnf_resource_ymls(args, config) Log.info { "cnf_resource_ymls" } destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - yml_file_path = config.cnf_config[:yml_file_path] helm_directory = sandbox_helm_directory(config.cnf_config[:helm_directory]) manifest_directory = config.cnf_config[:manifest_directory] release_name = config.cnf_config[:release_name] - helm_chart_path = config.cnf_config[:helm_chart_path] - manifest_file_path = config.cnf_config[:manifest_file_path] + helm_chart_path = Config.get_helm_chart_path(config) + manifest_file_path = Config.get_manifest_file_path(config) helm_values = config.cnf_config[:helm_values] test_passed = true deployment_namespace = CNFManager.get_deployment_namespace(config) - install_method = CNFInstall.cnf_installation_method(config) + install_method = config.cnf_config[:install_method] Log.debug { "install_method: #{install_method}" } template_ymls = [] of YAML::Any case install_method[0] @@ -134,7 +133,7 @@ module CNFManager # ``` def self.get_deployment_namespace(config) - install_method = CNFInstall.cnf_installation_method(config) + install_method = config.cnf_config[:install_method] case install_method[0] when CNFInstall::InstallMethod::HelmChart, Helm::InstallMethod::HelmDirectory if !config.cnf_config[:helm_install_namespace].empty? @@ -500,10 +499,8 @@ module CNFManager release_name = config.cnf_config[:release_name] install_method = config.cnf_config[:install_method] helm_directory = config.cnf_config[:helm_directory] - source_helm_directory = config.cnf_config[:source_helm_directory] manifest_directory = config.cnf_config[:manifest_directory] - helm_chart_path = config.cnf_config[:helm_chart_path] - destination_cnf_dir = CNFManager.cnf_destination_dir(config_file) + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] # Create a CNF sandbox dir FileUtils.mkdir_p(destination_cnf_dir) @@ -532,7 +529,7 @@ module CNFManager end when CNFInstall::InstallMethod::HelmDirectory Log.info { "preparing helm_directory sandbox" } - source_directory = config_source_dir(config_file) + "/" + source_helm_directory.split(" ")[0] # todo support parameters separately + source_directory = config_source_dir(config_file) + "/" + helm_directory.split(" ")[0] # todo support parameters separately src_path = Path[source_directory].expand.to_s Log.info { "cp -a #{src_path} #{destination_cnf_dir}" } @@ -564,7 +561,7 @@ module CNFManager config_file = config.cnf_config[:source_cnf_dir] helm_directory = config.cnf_config[:helm_directory] helm_chart = config.cnf_config[:helm_chart] - destination_cnf_dir = CNFManager.cnf_destination_dir(config_file) + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] #TODO don't think we need to make this here FileUtils.mkdir_p("#{destination_cnf_dir}/#{helm_directory}") @@ -644,11 +641,9 @@ module CNFManager Log.info { "helm_repo_name: #{helm_repo_name}" } Log.info { "helm_repo_url: #{helm_repo_url}" } - - helm_chart_path = config.cnf_config[:helm_chart_path] Log.debug { "helm_directory: #{helm_directory}" } - destination_cnf_dir = CNFManager.cnf_destination_dir(config_file) + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] Log.for("verbose").info { "destination_cnf_dir: #{destination_cnf_dir}" } if verbose Log.debug { "mkdir_p destination_cnf_dir: #{destination_cnf_dir}" } @@ -884,7 +879,6 @@ module CNFManager helm_repository = config.cnf_config[:helm_repository] helm_repo_name = "#{helm_repository && helm_repository["name"]}" helm_repo_url = "#{helm_repository && helm_repository["repo_url"]}" - helm_chart_path = config.cnf_config[:helm_chart_path] helm_chart = config.cnf_config[:helm_chart] destination_cnf_dir = config.cnf_config[:destination_cnf_dir] deployment_namespace = CNFManager.get_deployment_namespace(config) @@ -934,11 +928,12 @@ module CNFManager def self.sample_cleanup(config_file, force=false, installed_from_manifest=false, verbose=true) Log.info { "sample_cleanup" } Log.info { "sample_cleanup installed_from_manifest: #{installed_from_manifest}" } - destination_cnf_dir = CNFManager.cnf_destination_dir(config_file) - Log.info { "destination_cnf_dir: #{destination_cnf_dir}" } config = parsed_config_file(ensure_cnf_testsuite_yml_path(config_file)) parsed_config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) Log.for("verbose").info { "cleanup config: #{config.inspect}" } if verbose + destination_cnf_dir = parsed_config.cnf_config[:destination_cnf_dir] + Log.info { "destination_cnf_dir: #{destination_cnf_dir}" } + config_maps_dir = "#{destination_cnf_dir}/config_maps" if Dir.exists?(config_maps_dir) @@ -962,7 +957,7 @@ module CNFManager Log.for("sample_cleanup").info { "Destination dir #{destination_cnf_dir} exists" } end - install_method = CNFInstall.cnf_installation_method(parsed_config) + install_method = parsed_config.cnf_config[:install_method] Log.for("sample_cleanup:install_method").info { install_method } case install_method[0] when CNFInstall::InstallMethod::HelmChart, CNFInstall::InstallMethod::HelmDirectory diff --git a/src/tasks/utils/config.cr b/src/tasks/utils/config.cr index 52e8132bf..ef23bda10 100644 --- a/src/tasks/utils/config.cr +++ b/src/tasks/utils/config.cr @@ -14,15 +14,10 @@ module CNFManager end #when addeding to this you must add to task.cr's CNFManager::Config.new( property cnf_config : NamedTuple(destination_cnf_dir: String, - source_cnf_file: String, source_cnf_dir: String, - yml_file_path: String, install_method: Tuple(CNFInstall::InstallMethod, String), manifest_directory: String, helm_directory: String, - source_helm_directory: String, - helm_chart_path: String, - manifest_file_path: String, release_name: String, service_name: String, helm_repository: NamedTuple(name: String, repo_url: String) | Nil, @@ -74,9 +69,7 @@ module CNFManager destination_cnf_dir = CNFManager.cnf_destination_dir(yml_file) - yml_file_path = CNFManager.ensure_cnf_testsuite_dir(config_yml_path) - source_cnf_file = yml_file - source_cnf_dir = yml_file_path + source_cnf_dir = CNFManager.ensure_cnf_testsuite_dir(config_yml_path) manifest_directory = optional_key_as_string(config, "manifest_directory") if config["helm_repository"]? helm_repository = config["helm_repository"].as_h @@ -91,7 +84,6 @@ module CNFManager release_name = optional_key_as_string(config, "release_name") service_name = optional_key_as_string(config, "service_name") helm_directory = optional_key_as_string(config, "helm_directory") - source_helm_directory = optional_key_as_string(config, "helm_directory") helm_install_namespace = optional_key_as_string(config, "helm_install_namespace") if config["enabled"]? core_enabled = config["enabled"].as_bool.to_s @@ -132,21 +124,7 @@ module CNFManager smf = optional_key_as_string(config, "smf_label") upf = optional_key_as_string(config, "upf_label") ric = optional_key_as_string(config, "ric_label") - if helm_directory.empty? - working_chart_directory = "exported_chart" - Log.info { "USING EXPORTED CHART PATH" } - else - # todo separate parameters from helm directory - # TODO Fix bug with helm_directory for arguments, it creates an invalid path - # # we don't handle arguments anymore - # helm_directory = source_helm_directory.split("/")[0] + " " + source_helm_directory.split(" ")[1..-1].join(" ") - # helm_directory = optional_key_as_string(config, "helm_directory") - working_chart_directory = helm_directory - Log.info { "NOT USING EXPORTED CHART PATH" } - end - helm_chart_path = destination_cnf_dir + "/" + CNFManager.sandbox_helm_directory(working_chart_directory) - helm_chart_path = Path[helm_chart_path].expand.to_s - manifest_file_path = destination_cnf_dir + "/" + "temp_template.yml" + white_list_container_names = optional_key_as_string(config, "allowlist_helm_chart_container_names") if config["allowlist_helm_chart_container_names"]? white_list_container_names = config["allowlist_helm_chart_container_names"].as_a.map do |c| @@ -190,15 +168,10 @@ module CNFManager # if you change this, change instantiation in task.cr/single_task_runner as well new({ destination_cnf_dir: destination_cnf_dir, - source_cnf_file: source_cnf_file, source_cnf_dir: source_cnf_dir, - yml_file_path: yml_file_path, install_method: install_method, manifest_directory: manifest_directory, helm_directory: helm_directory, - source_helm_directory: source_helm_directory, - helm_chart_path: helm_chart_path, - manifest_file_path: manifest_file_path, release_name: release_name, service_name: service_name, helm_repository: {name: helm_repo_name, repo_url: helm_repo_url}, @@ -217,6 +190,26 @@ module CNFManager image_registry_fqdns: image_registry_fqdns,}) end + + def self.get_helm_chart_path(config) + helm_directory = config.cnf_config[:helm_directory] + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + if helm_directory.empty? + working_chart_directory = "exported_chart" + Log.info { "USING EXPORTED CHART PATH" } + else + working_chart_directory = helm_directory + Log.info { "NOT USING EXPORTED CHART PATH" } + end + helm_chart_path = destination_cnf_dir + "/" + CNFManager.sandbox_helm_directory(working_chart_directory) + helm_chart_path = Path[helm_chart_path].expand.to_s + end + + def self.get_manifest_file_path(config) + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + manifest_file_path = destination_cnf_dir + "/" + "temp_template.yml" + end + def self.install_method_by_config_file(config_file) : CNFInstall::InstallMethod LOGGING.info "install_data_by_config_file" config = CNFManager.parsed_config_file(config_file) diff --git a/src/tasks/utils/task.cr b/src/tasks/utils/task.cr index b24473736..55ea70a25 100644 --- a/src/tasks/utils/task.cr +++ b/src/tasks/utils/task.cr @@ -65,15 +65,10 @@ module CNFManager config = CNFManager::Config.parse_config_yml(args.named["cnf-config"].as(String)) else config = CNFManager::Config.new({ destination_cnf_dir: "", - source_cnf_file: "", source_cnf_dir: "", - yml_file_path: "", install_method: {CNFInstall::InstallMethod::HelmChart, ""}, manifest_directory: "", helm_directory: "", - source_helm_directory: "", - helm_chart_path: "", - manifest_file_path: "", release_name: "", service_name: "", helm_repository: {name: "", repo_url: ""}, diff --git a/src/tasks/workload/compatibility.cr b/src/tasks/workload/compatibility.cr index d65e4c752..e4a46b2cb 100644 --- a/src/tasks/workload/compatibility.cr +++ b/src/tasks/workload/compatibility.cr @@ -393,7 +393,6 @@ task "helm_deploy" do |t, args| helm_chart = config.cnf_config[:helm_chart] helm_directory = config.cnf_config[:helm_directory] release_name = config.cnf_config[:release_name] - yml_file_path = config.cnf_config[:yml_file_path] configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") #TODO check if json is empty helm_used = configmap["data"].as_h["helm_used"].as_s @@ -451,7 +450,7 @@ task "helm_chart_published", ["helm_local_install"] do |t, args| end task "helm_chart_valid", ["helm_local_install"] do |t, args| - CNFManager::Task.task_runner(args, task: t) do |args| + CNFManager::Task.task_runner(args, task: t) do |args, config| if check_verbose(args) Log.for("verbose").debug { "helm_chart_valid args.raw: #{args.raw}" } Log.for("verbose").debug { "helm_chart_valid args.named: #{args.named}" } @@ -459,9 +458,7 @@ task "helm_chart_valid", ["helm_local_install"] do |t, args| response = String::Builder.new - config = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - # helm_directory = config.get("helm_directory").as_s - helm_directory = optional_key_as_string(config, "helm_directory") + helm_directory = config.cnf_config[:helm_directory] if helm_directory.empty? working_chart_directory = "exported_chart" else @@ -478,7 +475,7 @@ task "helm_chart_valid", ["helm_local_install"] do |t, args| Log.for(t.name).debug { "current dir: #{current_dir}" } helm = Helm::BinarySingleton.helm - destination_cnf_dir = CNFManager.cnf_destination_dir(CNFManager.ensure_cnf_testsuite_dir(args.named["cnf-config"].as(String))) + destination_cnf_dir = config.cnf_config[:destination_cnf_dir] helm_lint_cmd = "#{helm} lint #{destination_cnf_dir}/#{working_chart_directory}" helm_lint_status = Process.run( diff --git a/src/tasks/workload/configuration.cr b/src/tasks/workload/configuration.cr index ca3e4073a..36f901b25 100644 --- a/src/tasks/workload/configuration.cr +++ b/src/tasks/workload/configuration.cr @@ -107,7 +107,7 @@ task "ip_addresses" do |t, args| cdir = FileUtils.pwd() response = String::Builder.new helm_directory = config.cnf_config[:helm_directory] - helm_chart_path = config.cnf_config[:helm_chart_path] + helm_chart_path = CNFManager::Config.get_helm_chart_path(config) Log.info { "Path: #{helm_chart_path}" } if File.directory?(helm_chart_path) # Switch to the helm chart directory diff --git a/src/tasks/workload/microservice.cr b/src/tasks/workload/microservice.cr index a2c7a486c..a4301572f 100644 --- a/src/tasks/workload/microservice.cr +++ b/src/tasks/workload/microservice.cr @@ -104,7 +104,6 @@ end desc "Does the CNF have a reasonable startup time (< 30 seconds)?" task "reasonable_startup_time" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - yml_file_path = config.cnf_config[:yml_file_path] helm_chart = config.cnf_config[:helm_chart] helm_directory = config.cnf_config[:helm_directory] release_name = config.cnf_config[:release_name] @@ -199,7 +198,7 @@ task "reasonable_image_size" do |t, args| Log.for(t.name).debug { "cnf_config: #{config}" } task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| - yml_file_path = config.cnf_config[:yml_file_path] + source_cnf_dir = config.cnf_config[:source_cnf_dir] if resource["kind"].downcase == "deployment" || resource["kind"].downcase == "statefulset" || @@ -245,9 +244,9 @@ task "reasonable_image_size" do |t, args| }[0..-2]}}}) puts "str_auths: #{str_auths}" end - File.write("#{yml_file_path}/config.json", str_auths) + File.write("#{source_cnf_dir}/config.json", str_auths) Dockerd.exec("mkdir -p /root/.docker/") - KubectlClient.cp("#{yml_file_path}/config.json #{TESTSUITE_NAMESPACE}/dockerd:/root/.docker/config.json") + KubectlClient.cp("#{source_cnf_dir}/config.json #{TESTSUITE_NAMESPACE}/dockerd:/root/.docker/config.json") end Log.info { "FQDN of the docker image: #{fqdn_image}" } diff --git a/src/tasks/workload/observability.cr b/src/tasks/workload/observability.cr index 51d94ce27..eac6d4f97 100644 --- a/src/tasks/workload/observability.cr +++ b/src/tasks/workload/observability.cr @@ -224,7 +224,6 @@ task "tracing" do |t, args| helm_chart = config.cnf_config[:helm_chart] helm_directory = config.cnf_config[:helm_directory] release_name = config.cnf_config[:release_name] - yml_file_path = config.cnf_config[:yml_file_path] configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") #TODO check if json is empty tracing_used = configmap["data"].as_h["tracing_used"].as_s diff --git a/src/tasks/workload/ran.cr b/src/tasks/workload/ran.cr index a52a2950e..946a99b0e 100644 --- a/src/tasks/workload/ran.cr +++ b/src/tasks/workload/ran.cr @@ -17,7 +17,6 @@ desc "Test if RAN uses the ORAN e2 interface" task "oran_e2_connection" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| release_name = config.cnf_config[:release_name] - destination_cnf_dir = CNFManager.cnf_destination_dir(CNFManager.ensure_cnf_testsuite_dir(args.named["cnf-config"].as(String))) if ORANMonitor.isCNFaRIC?(config.cnf_config) configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") e2_found = configmap["data"].as_h["e2_found"].as_s @@ -29,7 +28,7 @@ task "oran_e2_connection" do |t, args| CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Failed, "RAN does not connect to a RIC using the e2 standard interface") end else - CNFManager::TestcaseResult.new(CNFManager::ResultStatus::NA, "[oran_e2_connection] No ric designated in cnf_testsuite.yml for #{destination_cnf_dir}") + CNFManager::TestcaseResult.new(CNFManager::ResultStatus::NA, "[oran_e2_connection] No ric designated in cnf_testsuite.yml") end end