CI: Add path and namespace configuration for OC CNs
- Modify CN deployment and termination functions to include namespace and path parameters. - Update `Module_UE` class with new attributes for namespace and CN path. - Integrate `cnID` for OC CN deployment and termination in `epc.py`. - Extract `cn_id` from XML configurations for CN operations. - Update XML files to include `cn_id` tag for 5G Core initialization and termination. (Used in OAIUE and AW2S pipeline, for OC CN deployment. This change will not affect other CN deployments.)
This commit is contained in:
@@ -58,6 +58,8 @@ adb_ue_2:
|
|||||||
|
|
||||||
oc-cn5g:
|
oc-cn5g:
|
||||||
Host: avra
|
Host: avra
|
||||||
|
Namespace: "oaicicd-core-for-ci-ran"
|
||||||
|
CNPath: "/opt/oai-cn5g-fed-develop-2024-april-00102"
|
||||||
NetworkScript: echo "inet 172.21.6.102"
|
NetworkScript: echo "inet 172.21.6.102"
|
||||||
RunIperf3Server: False
|
RunIperf3Server: False
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ NAMESPACE = "oaicicd-ran"
|
|||||||
OCUrl = "https://api.oai.cs.eurecom.fr:6443"
|
OCUrl = "https://api.oai.cs.eurecom.fr:6443"
|
||||||
OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
|
OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
|
||||||
CI_OC_RAN_NAMESPACE = "oaicicd-ran"
|
CI_OC_RAN_NAMESPACE = "oaicicd-ran"
|
||||||
CI_OC_CORE_NAMESPACE = "oaicicd-core-for-ci-ran"
|
|
||||||
CN_IMAGES = ["mysql", "oai-nrf", "oai-amf", "oai-smf", "oai-upf", "oai-ausf", "oai-udm", "oai-udr", "oai-traffic-server"]
|
CN_IMAGES = ["mysql", "oai-nrf", "oai-amf", "oai-smf", "oai-upf", "oai-ausf", "oai-udm", "oai-udr", "oai-traffic-server"]
|
||||||
CN_CONTAINERS = ["", "-c nrf", "-c amf", "-c smf", "-c upf", "-c ausf", "-c udm", "-c udr", ""]
|
CN_CONTAINERS = ["", "-c nrf", "-c amf", "-c smf", "-c upf", "-c ausf", "-c udm", "-c udr", ""]
|
||||||
|
|
||||||
@@ -68,10 +67,9 @@ def OC_login(cmd, ocUserName, ocPassword, ocProjectName):
|
|||||||
def OC_logout(cmd):
|
def OC_logout(cmd):
|
||||||
cmd.run(f'oc logout')
|
cmd.run(f'oc logout')
|
||||||
|
|
||||||
def OC_deploy_CN(cmd, ocUserName, ocPassword):
|
def OC_deploy_CN(cmd, ocUserName, ocPassword, ocNamespace, path):
|
||||||
logging.debug('OC OAI CN5G: Deploying OAI CN5G on Openshift Cluster')
|
logging.debug(f'OC OAI CN5G: Deploying OAI CN5G on Openshift Cluster: {ocNamespace}')
|
||||||
path = "/opt/oai-cn5g-fed-develop-2024-april-00102"
|
succeeded = OC_login(cmd, ocUserName, ocPassword, ocNamespace)
|
||||||
succeeded = OC_login(cmd, ocUserName, ocPassword, CI_OC_CORE_NAMESPACE)
|
|
||||||
if not succeeded:
|
if not succeeded:
|
||||||
return False, CONST.OC_LOGIN_FAIL
|
return False, CONST.OC_LOGIN_FAIL
|
||||||
cmd.run('helm uninstall oai5gcn --wait --timeout 60s')
|
cmd.run('helm uninstall oai5gcn --wait --timeout 60s')
|
||||||
@@ -84,10 +82,9 @@ def OC_deploy_CN(cmd, ocUserName, ocPassword):
|
|||||||
OC_logout(cmd)
|
OC_logout(cmd)
|
||||||
return True, report
|
return True, report
|
||||||
|
|
||||||
def OC_undeploy_CN(cmd, ocUserName, ocPassword):
|
def OC_undeploy_CN(cmd, ocUserName, ocPassword, ocNamespace, path):
|
||||||
logging.debug('OC OAI CN5G: Terminating CN on Openshift Cluster')
|
logging.debug(f'OC OAI CN5G: Terminating CN on Openshift Cluster: {ocNamespace}')
|
||||||
path = "/opt/oai-cn5g-fed-develop-2024-april-00102"
|
succeeded = OC_login(cmd, ocUserName, ocPassword, ocNamespace)
|
||||||
succeeded = OC_login(cmd, ocUserName, ocPassword, CI_OC_CORE_NAMESPACE)
|
|
||||||
if not succeeded:
|
if not succeeded:
|
||||||
return False, CONST.OC_LOGIN_FAIL
|
return False, CONST.OC_LOGIN_FAIL
|
||||||
cmd.run(f'rm -Rf {path}/logs')
|
cmd.run(f'rm -Rf {path}/logs')
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ class Module_UE:
|
|||||||
self.logStore = m.get('LogStore')
|
self.logStore = m.get('LogStore')
|
||||||
self.cmd_prefix = m.get('CmdPrefix')
|
self.cmd_prefix = m.get('CmdPrefix')
|
||||||
self.runIperf3Server = m.get('RunIperf3Server', True)
|
self.runIperf3Server = m.get('RunIperf3Server', True)
|
||||||
|
self.namespace = m.get('Namespace')
|
||||||
|
self.cnPath = m.get('CNPath')
|
||||||
logging.info(f'initialized {self.module_name}@{self.host} from {filename}')
|
logging.info(f'initialized {self.module_name}@{self.host} from {filename}')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@@ -190,6 +192,12 @@ class Module_UE:
|
|||||||
def getHost(self):
|
def getHost(self):
|
||||||
return self.host
|
return self.host
|
||||||
|
|
||||||
|
def getNamespace(self):
|
||||||
|
return self.namespace
|
||||||
|
|
||||||
|
def getCNPath(self):
|
||||||
|
return self.cnPath
|
||||||
|
|
||||||
def getRunIperf3Server(self):
|
def getRunIperf3Server(self):
|
||||||
return self.runIperf3Server
|
return self.runIperf3Server
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -48,6 +48,7 @@ import helpreadme as HELP
|
|||||||
import constants as CONST
|
import constants as CONST
|
||||||
import cls_cluster as OC
|
import cls_cluster as OC
|
||||||
import cls_cmd
|
import cls_cmd
|
||||||
|
import cls_module
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Class Declaration
|
# Class Declaration
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
@@ -75,6 +76,7 @@ class EPCManagement():
|
|||||||
self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
|
self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
|
||||||
self.OCUserName = ''
|
self.OCUserName = ''
|
||||||
self.OCPassword = ''
|
self.OCPassword = ''
|
||||||
|
self.cnID = ''
|
||||||
self.imageToPull = ''
|
self.imageToPull = ''
|
||||||
self.eNBSourceCodePath = ''
|
self.eNBSourceCodePath = ''
|
||||||
|
|
||||||
@@ -298,7 +300,8 @@ class EPCManagement():
|
|||||||
html_cell += '(' + res4.group('date') + ')'
|
html_cell += '(' + res4.group('date') + ')'
|
||||||
html_cell += '\n'
|
html_cell += '\n'
|
||||||
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
|
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
|
||||||
succeeded, report = OC.OC_deploy_CN(mySSH, self.OCUserName, self.OCPassword)
|
cn = cls_module.Module_UE(self.cnID)
|
||||||
|
succeeded, report = OC.OC_deploy_CN(mySSH, self.OCUserName, self.OCPassword, cn.getNamespace(), cn.getCNPath())
|
||||||
if not succeeded:
|
if not succeeded:
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
@@ -575,7 +578,8 @@ class EPCManagement():
|
|||||||
mySSH.copyin(f'{self.SourceCodePath}/logs/test_logs_CN.zip','test_logs_CN.zip')
|
mySSH.copyin(f'{self.SourceCodePath}/logs/test_logs_CN.zip','test_logs_CN.zip')
|
||||||
logging.debug(message)
|
logging.debug(message)
|
||||||
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
|
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
|
||||||
succeeded, report = OC.OC_undeploy_CN(mySSH, self.OCUserName, self.OCPassword)
|
cn = cls_module.Module_UE(self.cnID)
|
||||||
|
succeeded, report = OC.OC_undeploy_CN(mySSH, self.OCUserName, self.OCPassword, cn.getNamespace(), cn.getCNPath())
|
||||||
if not succeeded:
|
if not succeeded:
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
|
|||||||
@@ -329,11 +329,13 @@ def GetParametersFromXML(action):
|
|||||||
string_field = test.findtext('args')
|
string_field = test.findtext('args')
|
||||||
if (string_field is not None):
|
if (string_field is not None):
|
||||||
EPC.cfgDeploy = string_field
|
EPC.cfgDeploy = string_field
|
||||||
|
EPC.cnID = test.findtext('cn_id')
|
||||||
|
|
||||||
elif action == 'Terminate_5GCN':
|
elif action == 'Terminate_5GCN':
|
||||||
string_field = test.findtext('args')
|
string_field = test.findtext('args')
|
||||||
if (string_field is not None):
|
if (string_field is not None):
|
||||||
EPC.cfgUnDeploy = string_field
|
EPC.cfgUnDeploy = string_field
|
||||||
|
EPC.cnID = test.findtext('cn_id')
|
||||||
|
|
||||||
elif action == 'Deploy_Object' or action == 'Undeploy_Object':
|
elif action == 'Deploy_Object' or action == 'Undeploy_Object':
|
||||||
eNB_instance=test.findtext('eNB_instance')
|
eNB_instance=test.findtext('eNB_instance')
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
<testCase id="060000">
|
<testCase id="060000">
|
||||||
<class>Terminate_5GCN</class>
|
<class>Terminate_5GCN</class>
|
||||||
<desc>Terminate 5G Core</desc>
|
<desc>Terminate 5G Core</desc>
|
||||||
|
<cn_id>oc-cn5g</cn_id>
|
||||||
</testCase>
|
</testCase>
|
||||||
|
|
||||||
</testCaseList>
|
</testCaseList>
|
||||||
|
|||||||
@@ -33,5 +33,6 @@
|
|||||||
<testCase id="000100">
|
<testCase id="000100">
|
||||||
<class>Initialize_5GCN</class>
|
<class>Initialize_5GCN</class>
|
||||||
<desc>Initialize 5G Core</desc>
|
<desc>Initialize 5G Core</desc>
|
||||||
|
<cn_id>oc-cn5g</cn_id>
|
||||||
</testCase>
|
</testCase>
|
||||||
</testCaseList>
|
</testCaseList>
|
||||||
|
|||||||
Reference in New Issue
Block a user