Commit 612956d3 authored by Raphael Defosseux's avatar Raphael Defosseux

feat(ci): adding pull strategy to b200 nsa/sa scenarios

 * also removing the Copy_Image_to_Test method, useless now
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 5480e983
......@@ -548,75 +548,6 @@ class Containerize():
HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK)
HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize)
def Copy_Image_to_Test_Server(self, HTML):
imageTag = 'develop'
if (self.ranAllowMerge):
imageTag = 'ci-temp'
lSsh = SSH.SSHConnection()
# Going to the Docker Registry server
if self.registrySvrId == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
elif self.registrySvrId == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
elif self.registrySvrId == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
lSsh.open(lIpAddr, lUserName, lPassWord)
lSsh.command('docker save ' + self.imageToCopy + ':' + imageTag + ' | gzip --fast > ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
ret = lSsh.copyin(lIpAddr, lUserName, lPassWord, '~/' + self.imageToCopy + '-' + imageTag + '.tar.gz', '.')
if ret != 0:
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK)
self.exitStatus = 1
return False
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
if lSsh.getBefore().count('cannot remove'):
HTML.CreateHtmlTestRow('file not created by docker save', 'KO', CONST.ALL_PROCESSES_OK)
self.exitStatus = 1
return False
lSsh.close()
# Going to the Test Server
if self.testSvrId == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
elif self.testSvrId == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
elif self.testSvrId == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
lSsh.open(lIpAddr, lUserName, lPassWord)
lSsh.copyout(lIpAddr, lUserName, lPassWord, './' + self.imageToCopy + '-' + imageTag + '.tar.gz', '~')
# copyout has no return code and will quit if something fails
lSsh.command('docker rmi ' + self.imageToCopy + ':' + imageTag, '\$', 10)
lSsh.command('docker load < ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
if lSsh.getBefore().count('o such file') or lSsh.getBefore().count('invalid tar header'):
logging.debug(lSsh.getBefore())
HTML.CreateHtmlTestRow('problem during docker load', 'KO', CONST.ALL_PROCESSES_OK)
self.exitStatus = 1
return False
lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60)
if lSsh.getBefore().count('cannot remove'):
HTML.CreateHtmlTestRow('file not copied during scp?', 'KO', CONST.ALL_PROCESSES_OK)
self.exitStatus = 1
return False
lSsh.close()
if os.path.isfile('./' + self.imageToCopy + '-' + imageTag + '.tar.gz'):
os.remove('./' + self.imageToCopy + '-' + imageTag + '.tar.gz')
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
return True
def ImageTagToUse(self, imageName):
shortCommit = self.ranCommitID[0:8]
if self.ranAllowMerge:
......@@ -838,11 +769,10 @@ class Containerize():
mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5)
mySSH.command('cp docker-compose.yml ci-docker-compose.yml', '\$', 5)
imageTag = 'develop'
if (self.ranAllowMerge):
imageTag = 'ci-temp'
mySSH.command('sed -i -e "s/image: oai-enb:latest/image: oai-enb:' + imageTag + '/" ci-docker-compose.yml', '\$', 2)
mySSH.command('sed -i -e "s/image: oai-gnb:latest/image: oai-gnb:' + imageTag + '/" ci-docker-compose.yml', '\$', 2)
imagesList = ['oai-enb', 'oai-gnb']
for image in imagesList:
imageToUse = self.ImageTagToUse(image)
mySSH.command(f'sed -i -e "s#image: {image}:latest#image: {imageToUse}#" ci-docker-compose.yml', '\$', 2)
localMmeIpAddr = EPC.MmeIPAddress
mySSH.command('sed -i -e "s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/" ci-docker-compose.yml', '\$', 2)
# if self.flexranCtrlDeployed:
......
......@@ -444,17 +444,6 @@ def GetParametersFromXML(action):
if (string_field is not None):
CONTAINERS.cliOptions = string_field
elif action == 'Copy_Image_to_Test':
string_field = test.findtext('image_name')
if (string_field is not None):
CONTAINERS.imageToCopy = string_field
string_field = test.findtext('registry_svr_id')
if (string_field is not None):
CONTAINERS.registrySvrId = string_field
string_field = test.findtext('test_svr_id')
if (string_field is not None):
CONTAINERS.testSvrId = string_field
elif action == 'Run_LDPCTest' or action == 'Run_NRulsimTest':
ldpc.runargs = test.findtext('physim_run_args')
......@@ -473,6 +462,7 @@ def GetParametersFromXML(action):
string_field = test.findtext('test_svr_id')
if (string_field is not None):
CONTAINERS.testSvrId = string_field
CONTAINERS.imageToPull.clear()
for image in test.findall('image_to_pull'):
string_field = image.findtext('image_name')
if (string_field is not None):
......@@ -956,10 +946,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
CONTAINERS.BuildImage(HTML)
elif action == 'Build_Proxy':
CONTAINERS.BuildProxy(HTML)
elif action == 'Copy_Image_to_Test':
success = CONTAINERS.Copy_Image_to_Test_Server(HTML)
if not success:
RAN.prematureExit = True
elif action == 'Push_Local_Registry':
success = CONTAINERS.Push_Image_to_Local_Registry(HTML)
if not success:
......
......@@ -40,7 +40,6 @@
- IdleSleep
- Perform_X2_Handover
- Build_Image
- Copy_Image_to_Test
- Deploy_Object
- Undeploy_Object
- Cppcheck_Analysis
......
......@@ -26,9 +26,10 @@
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>1</repeatCount>
<TestCaseRequestedList>
111110
111111
000001
010002
030000
030101
000001
030102
......@@ -49,6 +50,24 @@
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="111110">
<class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id>
<image_to_pull>
<image_name>oai-enb</image_name>
</image_to_pull>
</testCase>
<testCase id="111111">
<class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc>
<test_svr_id>1</test_svr_id>
<image_to_pull>
<image_name>oai-gnb</image_name>
</image_to_pull>
</testCase>
<testCase id="010000">
<class>Initialize_UE</class>
<desc>Initialize Quectel</desc>
......@@ -62,14 +81,6 @@
<id>idefix</id>
</testCase>
<testCase id="030000">
<class>Copy_Image_to_Test</class>
<desc>Copy gNB image to test server</desc>
<image_name>oai-gnb</image_name>
<registry_svr_id>0</registry_svr_id>
<test_svr_id>1</test_svr_id>
</testCase>
<testCase id="030101">
<class>Deploy_Object</class>
<desc>Deploy eNB (FDD/Band7/5MHz/B200) in a container</desc>
......
......@@ -28,6 +28,8 @@
<TestCaseRequestedList>
030202
030201
222220
222221
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -47,5 +49,17 @@
<eNB_serverId>1</eNB_serverId>
</testCase>
<testCase id="222220">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
<test_svr_id>0</test_svr_id>
</testCase>
<testCase id="222221">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
<test_svr_id>1</test_svr_id>
</testCase>
</testCaseList>
......@@ -26,8 +26,8 @@
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>1</repeatCount>
<TestCaseRequestedList>
111111
010002
030000
030101
000001
010000
......@@ -47,6 +47,15 @@
-->
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="111111">
<class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id>
<image_to_pull>
<image_name>oai-gnb</image_name>
</image_to_pull>
</testCase>
<testCase id="010000">
<class>Initialize_UE</class>
<desc>Initialize Quectel</desc>
......@@ -60,14 +69,6 @@
<id>idefix</id>
</testCase>
<testCase id="030000">
<class>Copy_Image_to_Test</class>
<desc>Copy gNB image to test server</desc>
<image_name>oai-gnb</image_name>
<registry_svr_id>1</registry_svr_id>
<test_svr_id>0</test_svr_id>
</testCase>
<testCase id="030101">
<class>Deploy_Object</class>
<desc>Deploy gNB (TDD/Band78/40MHz/B200) in a container</desc>
......
......@@ -27,6 +27,7 @@
<repeatCount>1</repeatCount>
<TestCaseRequestedList>
030201
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -39,4 +40,10 @@
<image_tag>sa-test</image_tag>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
<test_svr_id>0</test_svr_id>
</testCase>
</testCaseList>
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