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.
This commit is contained in:
Robert Schmidt
2025-08-14 14:55:04 +02:00
parent 3f4df04875
commit c4efe9feed
3 changed files with 18 additions and 22 deletions
+5 -5
View File
@@ -247,8 +247,8 @@ class Containerize():
self.proxyCommit = None self.proxyCommit = None
self.eNB_instance = 0 self.eNB_instance = 0
self.eNB_serverId = ['', '', ''] self.eNB_serverId = ['', '', '']
self.yamlPath = ['', '', ''] self.yamlPath = ''
self.services = ['', '', ''] self.services = ''
self.deploymentTag = '' self.deploymentTag = ''
self.cli = '' self.cli = ''
@@ -746,11 +746,11 @@ class Containerize():
num_attempts = self.num_attempts num_attempts = self.num_attempts
lSourcePath = self.eNBSourceCodePath lSourcePath = self.eNBSourceCodePath
logging.debug(f'Deploying OAI Object on server: {node}') 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 = f'{lSourcePath}/{yaml}'
wd_yaml = f'{wd}/docker-compose.y*ml' wd_yaml = f'{wd}/docker-compose.y*ml'
with cls_cmd.getConnection(node) as ssh: 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: if services == [] or services == ' ' or services == None:
msg = 'Cannot determine services to start' msg = 'Cannot determine services to start'
logging.error(msg) logging.error(msg)
@@ -788,7 +788,7 @@ class Containerize():
def UndeployObject(self, ctx, node, HTML, RAN): def UndeployObject(self, ctx, node, HTML, RAN):
lSourcePath = self.eNBSourceCodePath lSourcePath = self.eNBSourceCodePath
logging.debug(f'\u001B[1m Undeploying OAI Object from server: {node}\u001B[0m') 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}' wd = f'{lSourcePath}/{yaml}'
with cls_cmd.getConnection(node) as ssh: with cls_cmd.getConnection(node) as ssh:
ExistEnvFilePrint(ssh, wd) ExistEnvFilePrint(ssh, wd)
+2 -6
View File
@@ -285,18 +285,14 @@ def ExecuteActionWithParam(action, ctx):
elif action == 'Deploy_Object' or action == 'Undeploy_Object' or action == "Create_Workspace": elif action == 'Deploy_Object' or action == 'Undeploy_Object' or action == "Create_Workspace":
node = test.findtext('node') node = test.findtext('node')
string_field = test.findtext('yaml_path') CONTAINERS.yamlPath = test.findtext('yaml_path')
if (string_field is not None):
CONTAINERS.yamlPath[CONTAINERS.eNB_instance] = string_field
string_field=test.findtext('d_retx_th') string_field=test.findtext('d_retx_th')
if (string_field is not None): if (string_field is not None):
CONTAINERS.ran_checkers['d_retx_th'] = [float(x) for x in string_field.split(',')] CONTAINERS.ran_checkers['d_retx_th'] = [float(x) for x in string_field.split(',')]
string_field=test.findtext('u_retx_th') string_field=test.findtext('u_retx_th')
if (string_field is not None): if (string_field is not None):
CONTAINERS.ran_checkers['u_retx_th'] = [float(x) for x in string_field.split(',')] CONTAINERS.ran_checkers['u_retx_th'] = [float(x) for x in string_field.split(',')]
string_field = test.findtext('services') CONTAINERS.services = test.findtext('services')
if string_field is not None:
CONTAINERS.services[CONTAINERS.eNB_instance] = string_field
CONTAINERS.num_attempts = int(test.findtext('num_attempts') or 1) CONTAINERS.num_attempts = int(test.findtext('num_attempts') or 1)
CONTAINERS.deploymentTag = cls_containerize.CreateTag(CONTAINERS.ranCommitID, CONTAINERS.ranBranch, CONTAINERS.ranAllowMerge) CONTAINERS.deploymentTag = cls_containerize.CreateTag(CONTAINERS.ranCommitID, CONTAINERS.ranBranch, CONTAINERS.ranAllowMerge)
if action == 'Deploy_Object': if action == 'Deploy_Object':
+11 -11
View File
@@ -40,7 +40,7 @@ class TestDeploymentMethods(unittest.TestCase):
self.ci = cls_oaicitest.OaiCiTest() self.ci = cls_oaicitest.OaiCiTest()
self.cont = cls_containerize.Containerize() self.cont = cls_containerize.Containerize()
self.ran = ran.RANManagement() self.ran = ran.RANManagement()
self.cont.yamlPath[0] = '' self.cont.yamlPath = ''
self.cont.ranAllowMerge = True self.cont.ranAllowMerge = True
self.cont.ranBranch = '' self.cont.ranBranch = ''
self.cont.ranCommitID = '' self.cont.ranCommitID = ''
@@ -53,7 +53,7 @@ class TestDeploymentMethods(unittest.TestCase):
c.run(f'rm -rf {self.ctx.logPath}') c.run(f'rm -rf {self.ctx.logPath}')
def test_deploy(self): def test_deploy(self):
self.cont.yamlPath[0] = 'tests/simple-dep/' self.cont.yamlPath = 'tests/simple-dep/'
self.cont.deploymentTag = "noble" self.cont.deploymentTag = "noble"
deploy = self.cont.DeployObject(self.ctx, self.node, self.html) deploy = self.cont.DeployObject(self.ctx, self.node, self.html)
undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
@@ -63,7 +63,7 @@ class TestDeploymentMethods(unittest.TestCase):
def test_deployfails(self): def test_deployfails(self):
# fails reliably # fails reliably
old = self.cont.yamlPath 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) deploy = self.cont.DeployObject(self.ctx, self.node, self.html)
self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
self.assertFalse(deploy) self.assertFalse(deploy)
@@ -72,15 +72,15 @@ class TestDeploymentMethods(unittest.TestCase):
def test_deployfails_2svc(self): def test_deployfails_2svc(self):
# fails reliably # fails reliably
old = self.cont.yamlPath 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) deploy = self.cont.DeployObject(self.ctx, self.node, self.html)
self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
self.assertFalse(deploy) self.assertFalse(deploy)
self.cont.yamlPath = old self.cont.yamlPath = old
def test_deploy_ran(self): def test_deploy_ran(self):
self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora'
self.cont.services[0] = "oai-gnb" self.cont.services = "oai-gnb"
self.cont.deploymentTag = 'develop-12345678' self.cont.deploymentTag = 'develop-12345678'
deploy = self.cont.DeployObject(self.ctx, self.node, self.html) deploy = self.cont.DeployObject(self.ctx, self.node, self.html)
undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
@@ -88,8 +88,8 @@ class TestDeploymentMethods(unittest.TestCase):
self.assertTrue(undeploy) self.assertTrue(undeploy)
def test_deploy_multiran(self): def test_deploy_multiran(self):
self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora'
self.cont.services[0] = "oai-gnb oai-nr-ue" self.cont.services = "oai-gnb oai-nr-ue"
self.cont.deploymentTag = 'develop-12345678' self.cont.deploymentTag = 'develop-12345678'
deploy = self.cont.DeployObject(self.ctx, self.node, self.html) deploy = self.cont.DeployObject(self.ctx, self.node, self.html)
undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
@@ -97,11 +97,11 @@ class TestDeploymentMethods(unittest.TestCase):
self.assertTrue(undeploy) self.assertTrue(undeploy)
def test_deploy_staged(self): def test_deploy_staged(self):
self.cont.yamlPath[0] = 'yaml_files/5g_rfsimulator_tdd_dora' self.cont.yamlPath = 'yaml_files/5g_rfsimulator_tdd_dora'
self.cont.services[0] = "oai-gnb" self.cont.services = "oai-gnb"
self.cont.deploymentTag = 'develop-12345678' self.cont.deploymentTag = 'develop-12345678'
deploy1 = self.cont.DeployObject(self.ctx, self.node, self.html) 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) deploy2 = self.cont.DeployObject(self.ctx, self.node, self.html)
undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran) undeploy = self.cont.UndeployObject(self.ctx, self.node, self.html, self.ran)
self.assertTrue(deploy1) self.assertTrue(deploy1)