Commit deddca13 authored by Mohammed Ismail's avatar Mohammed Ismail

CI: syntax fix

Signed-off-by: default avatarMohammed Ismail <mohammed.ismail@openairinterface.org>
parent ef71bb98
...@@ -43,9 +43,9 @@ class PhySim: ...@@ -43,9 +43,9 @@ class PhySim:
self.eNBIpAddr = "" self.eNBIpAddr = ""
self.eNBUserName = "" self.eNBUserName = ""
self.eNBPassword = "" self.eNBPassword = ""
self.OCUserName = "" self.OCUserName = ""
self.OCPassword = "" self.OCPassword = ""
self.OCWorkspace = "" self.OCWorkspace = ""
self.eNBSourceCodePath = "" self.eNBSourceCodePath = ""
self.ranRepository = "" self.ranRepository = ""
self.ranBranch = "" self.ranBranch = ""
...@@ -96,10 +96,10 @@ class PhySim: ...@@ -96,10 +96,10 @@ class PhySim:
mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5)
mySSH.command("sudo podman image inspect --format='Size = {{.Size}} bytes' oai-physim:ci-temp", '\$', 60) mySSH.command("sudo podman image inspect --format='Size = {{.Size}} bytes' oai-physim:ci-temp", '\$', 60)
if mySSH.getBefore().count('no such image') != 0: if mySSH.getBefore().count('no such image') != 0:
logging.error('\u001B[1m No such image oai-physim\u001B[0m') logging.error('\u001B[1m No such image oai-physim\u001B[0m')
else: else:
result = re.search('Size *= *(?P<size>[0-9\-]+) *bytes', mySSH.getBefore()) result = re.search('Size *= *(?P<size>[0-9\-]+) *bytes', mySSH.getBefore())
if result is not None: if result is not None:
imageSize = float(result.group('size')) imageSize = float(result.group('size'))
imageSize = imageSize / 1000 imageSize = imageSize / 1000
...@@ -115,46 +115,46 @@ class PhySim: ...@@ -115,46 +115,46 @@ class PhySim:
else: else:
logging.debug('oai-physim size is unknown') logging.debug('oai-physim size is unknown')
# logging to OC cluster # logging to OC cluster
mySSH.command('oc login -u {self.OCUserName} -p {self.OCPassword}', '\$', 6) mySSH.command('oc login -u {self.OCUserName} -p {self.OCPassword}', '\$', 6)
if mySSH.getBefore().count('Login successful') == 0: if mySSH.getBefore().count('Login successful') == 0:
logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m')
else: else:
logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m') logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m')
mySSH.command('oc project {self.OCWorkspace}', '\$', 6) mySSH.command('oc project {self.OCWorkspace}', '\$', 6)
if (mySSH.getBefore().count('Already on project "{self.OCWorkspace}"')) == 0 or (mySSH.getBefore().count('Now using project "{self.OCWorkspace}"')) == 0: if (mySSH.getBefore().count('Already on project "{self.OCWorkspace}"')) == 0 or (mySSH.getBefore().count('Now using project "{self.OCWorkspace}"')) == 0:
logging.error('\u001B[1m Unable to access OC project {self.OCWorkspace}\u001B[0m') logging.error('\u001B[1m Unable to access OC project {self.OCWorkspace}\u001B[0m')
else: else:
logging.debug('\u001B[1m Now using project {self.OCWorkspace}\u001B[0m') logging.debug('\u001B[1m Now using project {self.OCWorkspace}\u001B[0m')
# Using helm charts deployment # Using helm charts deployment
mySSH.command('helm install physim ./charts/physims/', '\$', 6) mySSH.command('helm install physim ./charts/physims/', '\$', 6)
if mySSH.getBefore().count('STATUS: deployed') == 0: if mySSH.getBefore().count('STATUS: deployed') == 0:
logging.error('\u001B[1m Deploying PhySim Failed using helm chart\u001B[0m') logging.error('\u001B[1m Deploying PhySim Failed using helm chart\u001B[0m')
else: else:
logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m') logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m')
isRunning = False isRunning = False
while(isRunning == False): while(isRunning == False):
mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6) mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6)
if mySSH.getBefore().count('Running') == 12 if mySSH.getBefore().count('Running') == 12:
logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m') logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m')
isRunning = True isRunning = True
podNames = re.findall('oai[\S\d\w]+', mySSH.getBefore()) podNames = re.findall('oai[\S\d\w]+', mySSH.getBefore())
# Waiting to complete the running test # Waiting to complete the running test
count = 0 count = 0
isFinished = False isFinished = False
while(count < 25 or isFinished == False): while(count < 25 or isFinished == False):
time.sleep(60) time.sleep(60)
mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6) mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6)
result = re.search('oai-nr-dlsim[\S\d\w]+', mySSH.getBefore()) result = re.search('oai-nr-dlsim[\S\d\w]+', mySSH.getBefore())
if result is not None: if result is not None:
podName1 = result.group() podName1 = result.group()
mySSH.command('oc logs {podName1}', '\$', 6) mySSH.command('oc logs {podName1}', '\$', 6)
if mySSH.getBefore().count('Finished') != 0: if mySSH.getBefore().count('Finished') != 0:
isFinished = True isFinished = True
count += 1 count += 1
if isFinished: if isFinished:
logging.debug('\u001B[1m PhySim test is Complete\u001B[0m') logging.debug('\u001B[1m PhySim test is Complete\u001B[0m')
# Getting the logs of each executables running in individual pods # Getting the logs of each executables running in individual pods
for podName in podNames: for podName in podNames:
...@@ -164,8 +164,8 @@ class PhySim: ...@@ -164,8 +164,8 @@ class PhySim:
mySSH.command('mv log/* ' + 'physim_test_log_' + self.testCase_id, '\$', 5) mySSH.command('mv log/* ' + 'physim_test_log_' + self.testCase_id, '\$', 5)
# UnDeploy the physical simulator pods # UnDeploy the physical simulator pods
mySSH.command('helm uninstall physim', '\$', 10) mySSH.command('helm uninstall physim', '\$', 10)
if mySSH.getBefore().count('release "physim" uninstalled') != 0 if mySSH.getBefore().count('release "physim" uninstalled') != 0:
logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m')
else: else:
logging.debug('\u001B[1m Failed to UnDeploy PhySim on OC Cluster\u001B[0m') logging.debug('\u001B[1m Failed to UnDeploy PhySim on OC Cluster\u001B[0m')
mySSH.close() mySSH.close()
......
...@@ -391,7 +391,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b ...@@ -391,7 +391,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b
#----------------------------------------------------------- #-----------------------------------------------------------
import args_parse import args_parse
py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA) py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment