Commit 6af1364d authored by Gabriele Perrone's avatar Gabriele Perrone

Removed the old ssh commands from orignal implementaion location

FIx missing replacement
parent d1e02e22
......@@ -186,167 +186,6 @@ class OaiCiTest():
self.expectedNbOfConnectedUEs = 0
self.startTime = 0
def open(self, ipaddress, username, password):
count = 0
connect_status = False
while count < 4:
self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5)
self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
self.ssh.sendline('yes')
self.ssh.expect('password:')
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
count = 10
connect_status = True
else:
logging.debug('self.sshresponse = ' + str(self.sshresponse))
elif self.sshresponse == 1:
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
count = 10
connect_status = True
else:
logging.debug('self.sshresponse = ' + str(self.sshresponse))
elif self.sshresponse == 2:
# Checking if we are really on the remote client defined by its IP address
SSH.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:|inet "', '\$', 5)
result = re.search(str(ipaddress), SSH.getBefore())
if result is None:
SSH.close()
else:
count = 10
connect_status = True
else:
# debug output
logging.debug(SSH.getBefore())
logging.debug('self.sshresponse = ' + str(self.sshresponse))
# adding a tempo when failure
if not connect_status:
time.sleep(1)
count += 1
if connect_status:
pass
else:
sys.exit('CiTestObj.Connection Failed')
def command(self, commandline, expectedline, timeout):
logging.debug(commandline)
self.ssh.timeout = timeout
self.ssh.sendline(commandline)
self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
return 0
elif self.sshresponse == 1:
logging.debug('\u001B[1;37;41m Unexpected EOF \u001B[0m')
logging.debug('Expected Line : ' + expectedline)
sys.exit(self.sshresponse)
elif self.sshresponse == 2:
logging.debug('\u001B[1;37;41m Unexpected TIMEOUT \u001B[0m')
logging.debug('Expected Line : ' + expectedline)
result = re.search('ping |iperf |picocom', str(commandline))
if result is None:
logging.debug(SSH.getBefore())
sys.exit(self.sshresponse)
else:
return -1
else:
logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m')
logging.debug('Expected Line : ' + expectedline)
sys.exit(self.sshresponse)
def close(self):
self.ssh.timeout = 5
self.ssh.sendline('exit')
self.sshresponse = self.ssh.expect([pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
pass
elif self.sshresponse == 1:
if not self.picocom_closure:
logging.debug('\u001B[1;37;41m Unexpected TIMEOUT during closing\u001B[0m')
else:
logging.debug('\u001B[1;37;41m Unexpected Others during closing\u001B[0m')
def copyin(self, ipaddress, username, password, source, destination):
count = 0
copy_status = False
logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination)
while count < 10:
scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 100)
scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
scp_spawn.sendline('yes')
scp_spawn.expect('password:')
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
count = 10
copy_status = True
else:
logging.debug('1 - scp_response = ' + str(scp_response))
elif scp_response == 1:
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0 or scp_response == 3:
count = 10
copy_status = True
else:
logging.debug('2 - scp_response = ' + str(scp_response))
elif scp_response == 2:
count = 10
copy_status = True
else:
logging.debug('3 - scp_response = ' + str(scp_response))
# adding a tempo when failure
if not copy_status:
time.sleep(1)
count += 1
if copy_status:
return 0
else:
return -1
def copyout(self, ipaddress, username, password, source, destination):
count = 0
copy_status = False
logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination)
while count < 4:
scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 100)
scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
scp_spawn.sendline('yes')
scp_spawn.expect('password:')
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0:
count = 10
copy_status = True
else:
logging.debug('1 - scp_response = ' + str(scp_response))
elif scp_response == 1:
scp_spawn.sendline(password)
scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0 or scp_response == 3:
count = 10
copy_status = True
else:
logging.debug('2 - scp_response = ' + str(scp_response))
elif scp_response == 2:
count = 10
copy_status = True
else:
logging.debug('3 - scp_response = ' + str(scp_response))
# adding a tempo when failure
if not copy_status:
time.sleep(1)
count += 1
if copy_status:
pass
else:
sys.exit('SCP failed')
def BuildeNB(self):
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
Usage()
......@@ -4760,8 +4599,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
sys.exit('Insufficient Parameter')
if (CiTestObj.EPCIPAddress != '') and (CiTestObj.EPCIPAddress != 'none'):
CiTestObj.copyout(CiTestObj.EPCIPAddress, CiTestObj.EPCUserName, CiTestObj.EPCPassword, cwd + "/tcp_iperf_stats.awk", "/tmp")
CiTestObj.copyout(CiTestObj.EPCIPAddress, CiTestObj.EPCUserName, CiTestObj.EPCPassword, cwd + "/active_net_interfaces.awk", "/tmp")
SSH.copyout(CiTestObj.EPCIPAddress, CiTestObj.EPCUserName, CiTestObj.EPCPassword, cwd + "/tcp_iperf_stats.awk", "/tmp")
SSH.copyout(CiTestObj.EPCIPAddress, CiTestObj.EPCUserName, CiTestObj.EPCPassword, cwd + "/active_net_interfaces.awk", "/tmp")
else:
if CiTestObj.UEIPAddress == '' or CiTestObj.ranRepository == '' or CiTestObj.ranBranch == '' or CiTestObj.UEUserName == '' or CiTestObj.UEPassword == '' or CiTestObj.UESourceCodePath == '':
Usage()
......
python3 main.py --mode=InitiateHtml --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=develop --ranCommitID=424bf5c53e879af7d66aaa50e0cd969eeb570dbd --ranAllowMerge=false --ranTargetBranch=develop --ADBIPAddress=192.168.12.240 --ADBUserName=bourdon --ADBPassword=linux --XMLTestFile=xml_files/dummy_build.xml --XMLTestFile=xml_files/dummy_ltebox_start.xml --XMLTestFile=xml_files/dummy_enb_test.xml --XMLTestFile=xml_files/dummy_ltebox_stop.xml
python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=develop --ranCommitID=424bf5c53e879af7d66aaa50e0cd969eeb570dbd --ranAllowMerge=false --ranTargetBranch=develop --eNBIPAddress=192.168.12.161 --eNBUserName=acilius --eNBPassword=linux --eNBSourceCodePath=/tmp/CI-gabriele --EPCIPAddress=192.168.12.240 --EPCType=ltebox --EPCUserName=bourdon --EPCPassword=linux --EPCSourceCodePath=/tmp/CI-eNB --ADBIPAddress=192.168.12.240 --ADBUserName=bourdon --ADBPassword=linux --XMLTestFile=xml_files/dummy_build.xml
python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=develop --ranCommitID=424bf5c53e879af7d66aaa50e0cd969eeb570dbd --ranAllowMerge=false --ranTargetBranch=develop --eNBIPAddress=192.168.12.161 --eNBUserName=acilius --eNBPassword=linux --eNBSourceCodePath=/tmp/CI-gabriele --EPCIPAddress=192.168.12.240 --EPCType=ltebox --EPCUserName=bourdon --EPCPassword=linux --EPCSourceCodePath=/tmp/CI-eNB --ADBIPAddress=192.168.12.240 --ADBUserName=bourdon --ADBPassword=linux --XMLTestFile=xml_files/dummy_ltebox_start.xml
python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=develop --ranCommitID=424bf5c53e879af7d66aaa50e0cd969eeb570dbd --ranAllowMerge=false --ranTargetBranch=develop --eNBIPAddress=192.168.12.161 --eNBUserName=acilius --eNBPassword=linux --eNBSourceCodePath=/tmp/CI-gabriele --EPCIPAddress=192.168.12.240 --EPCType=ltebox --EPCUserName=bourdon --EPCPassword=linux --EPCSourceCodePath=/tmp/CI-eNB --ADBIPAddress=192.168.12.240 --ADBUserName=bourdon --ADBPassword=linux --XMLTestFile=xml_files/dummy_enb_test.xml
python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=develop --ranCommitID=424bf5c53e879af7d66aaa50e0cd969eeb570dbd --ranAllowMerge=false --ranTargetBranch=develop --eNBIPAddress=192.168.12.161 --eNBUserName=acilius --eNBPassword=linux --eNBSourceCodePath=/tmp/CI-gabriele --EPCIPAddress=192.168.12.240 --EPCType=ltebox --EPCUserName=bourdon --EPCPassword=linux --EPCSourceCodePath=/tmp/CI-eNB --ADBIPAddress=192.168.12.240 --ADBUserName=bourdon --ADBPassword=linux --XMLTestFile=xml_files/dummy_ltebox_stop.xml
python3 main.py --mode=FinalizeHtml --finalStatus=true --eNBIPAddress=192.168.12.161 --eNBUserName=acilius --eNBPassword=linux
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>epc-start</htmlTabRef>
<htmlTabName>EPC-Start</htmlTabName>
<htmlTabIcon>log-in</htmlTabIcon>
<TestCaseRequestedList>
010101
050101 060101 070101
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="010101">
<class>Build_eNB</class>
<desc>Build eNB (USRP)</desc>
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
</testCase>
<testCase id="050101">
<class>Initialize_HSS</class>
<desc>Initialize HSS</desc>
</testCase>
<testCase id="060101">
<class>Initialize_MME</class>
<desc>Initialize MME</desc>
</testCase>
<testCase id="070101">
<class>Initialize_SPGW</class>
<desc>Initialize SPGW</desc>
</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