From c4efe9feed59fe8299477902332c4d5e21ad24b5 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 11 Aug 2025 13:11:00 +0200 Subject: [PATCH] cls_containerize: yamlPath/services as normal string These variables were set as lists, to be indexed by the "server ID". Since this has been removed from all XMLs, it is not necessary anymore. --- ci-scripts/cls_containerize.py | 10 +++++----- ci-scripts/main.py | 8 ++------ ci-scripts/tests/deployment.py | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 282fe0f4a0..b45aed5d8d 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -247,8 +247,8 @@ class Containerize(): self.proxyCommit = None self.eNB_instance = 0 self.eNB_serverId = ['', '', ''] - self.yamlPath = ['', '', ''] - self.services = ['', '', ''] + self.yamlPath = '' + self.services = '' self.deploymentTag = '' self.cli = '' @@ -746,11 +746,11 @@ class Containerize(): num_attempts = self.num_attempts lSourcePath = self.eNBSourceCodePath logging.debug(f'Deploying OAI Object on server: {node}') - yaml = self.yamlPath[self.eNB_instance].strip('/') + yaml = self.yamlPath.strip('/') wd = f'{lSourcePath}/{yaml}' wd_yaml = f'{wd}/docker-compose.y*ml' with cls_cmd.getConnection(node) as ssh: - services = GetServices(ssh, self.services[self.eNB_instance], wd_yaml) + services = GetServices(ssh, self.services, wd_yaml) if services == [] or services == ' ' or services == None: msg = 'Cannot determine services to start' logging.error(msg) @@ -788,7 +788,7 @@ class Containerize(): def UndeployObject(self, ctx, node, HTML, RAN): lSourcePath = self.eNBSourceCodePath logging.debug(f'\u001B[1m Undeploying OAI Object from server: {node}\u001B[0m') - yaml = self.yamlPath[self.eNB_instance].strip('/') + yaml = self.yamlPath.strip('/') wd = f'{lSourcePath}/{yaml}' with cls_cmd.getConnection(node) as ssh: ExistEnvFilePrint(ssh, wd) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 90b5b7de90..76c3962437 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -285,18 +285,14 @@ def ExecuteActionWithParam(action, ctx): elif action == 'Deploy_Object' or action == 'Undeploy_Object' or action == "Create_Workspace": node = test.findtext('node') - string_field = test.findtext('yaml_path') - if (string_field is not None): - CONTAINERS.yamlPath[CONTAINERS.eNB_instance] = string_field + CONTAINERS.yamlPath = test.findtext('yaml_path') string_field=test.findtext('d_retx_th') if (string_field is not None): CONTAINERS.ran_checkers['d_retx_th'] = [float(x) for x in string_field.split(',')] string_field=test.findtext('u_retx_th') if (string_field is not None): CONTAINERS.ran_checkers['u_retx_th'] = [float(x) for x in string_field.split(',')] - string_field = test.findtext('services') - if string_field is not None: - CONTAINERS.services[CONTAINERS.eNB_instance] = string_field + CONTAINERS.services = test.findtext('services') CONTAINERS.num_attempts = int(test.findtext('num_attempts') or 1) CONTAINERS.deploymentTag = cls_containerize.CreateTag(CONTAINERS.ranCommitID, CONTAINERS.ranBranch, CONTAINERS.ranAllowMerge) if action == 'Deploy_Object': diff --git a/ci-scripts/tests/deployment.py b/ci-scripts/tests/deployment.py index 60c88f39a1..e7efc707bf 100644 --- a/ci-scripts/tests/deployment.py +++ b/ci-scripts/tests/deployment.py @@ -40,7 +40,7 @@ class TestDeploymentMethods(unittest.TestCase): self.ci = cls_oaicitest.OaiCiTest() self.cont = cls_containerize.Containerize() self.ran = ran.RANManagement() - self.cont.yamlPath[0] = '' + self.cont.yamlPath = '' self.cont.ranAllowMerge = True self.cont.ranBranch = '' self.cont.ranCommitID = '' @@ -53,7 +53,7 @@ class TestDeploymentMethods(unittest.TestCase): c.run(f'rm -rf {self.ctx.logPath}') def test_deploy(self): - self.cont.yamlPath[0] = 'tests/simple-dep/' + self.cont.yamlPath = 'tests/simple-dep/' self.cont.deploymentTag = "noble" deploy = self.cont.DeployObject(self.ctx, self.node, self.html) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) @@ -63,7 +63,7 @@ class TestDeploymentMethods(unittest.TestCase): def test_deployfails(self): # fails reliably old = self.cont.yamlPath - self.cont.yamlPath[0] = 'tests/simple-fail/' + self.cont.yamlPath = 'tests/simple-fail/' deploy = self.cont.DeployObject(self.ctx, self.node, self.html) self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) self.assertFalse(deploy) @@ -72,15 +72,15 @@ class TestDeploymentMethods(unittest.TestCase): def test_deployfails_2svc(self): # fails reliably old = self.cont.yamlPath - self.cont.yamlPath[0] = 'tests/simple-fail-2svc/' + self.cont.yamlPath = 'tests/simple-fail-2svc/' deploy = self.cont.DeployObject(self.ctx, self.node, self.html) self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) self.assertFalse(deploy) self.cont.yamlPath = old def test_deploy_ran(self): - self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' - self.cont.services[0] = "oai-gnb" + self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora' + self.cont.services = "oai-gnb" self.cont.deploymentTag = 'develop-12345678' deploy = self.cont.DeployObject(self.ctx, self.node, self.html) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) @@ -88,8 +88,8 @@ class TestDeploymentMethods(unittest.TestCase): self.assertTrue(undeploy) def test_deploy_multiran(self): - self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' - self.cont.services[0] = "oai-gnb oai-nr-ue" + self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora' + self.cont.services = "oai-gnb oai-nr-ue" self.cont.deploymentTag = 'develop-12345678' deploy = self.cont.DeployObject(self.ctx, self.node, self.html) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) @@ -97,11 +97,11 @@ class TestDeploymentMethods(unittest.TestCase): self.assertTrue(undeploy) def test_deploy_staged(self): - self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' - self.cont.services[0] = "oai-gnb" + self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora' + self.cont.services = "oai-gnb" self.cont.deploymentTag = 'develop-12345678' deploy1 = self.cont.DeployObject(self.ctx, self.node, self.html) - self.cont.services[0] = "oai-nr-ue" + self.cont.services = "oai-nr-ue" deploy2 = self.cont.DeployObject(self.ctx, self.node, self.html) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) self.assertTrue(deploy1)