diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 77c4d940f7..282667df31 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -854,6 +854,35 @@ class OaiCiTest(): HTML.CreateHtmlTestRowQueue(f'N/A', 'OK', messages) return True + def DeployCoreNetwork(cn_id, HTML): + core_name = cn_id.strip() + cn = cls_corenetwork.CoreNetwork(core_name) + success, output = cn.deploy() + logging.info(f"deployment core network {core_name} success {success}, output:\n{output}") + if success: + msg = f"Started {cn}" + HTML.CreateHtmlTestRowQueue(core_name, 'OK', [msg]) + else: + msg = f"deployment of core network {core_name} FAILED" + logging.error(msg) + HTML.CreateHtmlTestRowQueue(core_name, 'KO', [msg]) + return success + + def UndeployCoreNetwork(cn_id, HTML): + # Ping, Iperf, DeployObject put logs into a path based on YAML. We + # can't do this here (because there is no yaml), so hardcode a path for + # "cn_logs" for the moment + logPath = f'{os.getcwd()}/../cmake_targets/log/cn_logs' + with cls_cmd.getConnection('localhost') as local: + local.run(f'mkdir -p {logPath}', silent=True) + core_name = cn_id.strip() + cn = cls_corenetwork.CoreNetwork(core_name) + logs, output = cn.undeploy(log_dir=logPath) + logging.info(f"undeployed core network {core_name}, logs {logs}, output:\n{output}") + message = "Log files: " + ", ".join([os.path.basename(l) for l in logs]) + HTML.CreateHtmlTestRowQueue(core_name, 'OK', [message]) + return True + def LogCollectBuild(self,RAN): # Some pipelines are using "none" IP / Credentials # In that case, just forget about it diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 0bb21a785d..efb4f97166 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -339,6 +339,11 @@ def ExecuteActionWithParam(action): EPC.cnID = test.findtext('cn_id') success = EPC.Terminate5GCN(HTML) + elif action == 'DeployCoreNetwork' or action == 'UndeployCoreNetwork': + cn_id = test.findtext('cn_id') + core_op = getattr(cls_oaicitest.OaiCiTest, action) + success = core_op(cn_id, HTML) + elif action == 'Deploy_Object' or action == 'Undeploy_Object' or action == "Create_Workspace": eNB_instance=test.findtext('eNB_instance') if (eNB_instance is None): diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index a526058af0..5ad4c0820e 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -25,6 +25,8 @@ - Terminate_SPGW - Initialize_5GCN - Terminate_5GCN + - DeployCoreNetwork + - UndeployCoreNetwork - IdleSleep - Build_Image - Build_Run_Tests