Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
promise
OpenXG-RAN
Commits
5431c6f8
Commit
5431c6f8
authored
Jan 11, 2019
by
Louis Adrien Dufrene
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into ulsch_scheduler_opti
parents
a748262e
ce7067c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
41 deletions
+63
-41
ci-scripts/main.py
ci-scripts/main.py
+63
-41
No files found.
ci-scripts/main.py
View file @
5431c6f8
...
...
@@ -203,59 +203,81 @@ class SSHConnection():
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
)
scp_spawn
=
pexpect
.
spawn
(
'scp '
+
username
+
'@'
+
ipaddress
+
':'
+
source
+
' '
+
destination
,
timeout
=
5
)
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
])
while
count
<
4
:
scp_spawn
=
pexpect
.
spawn
(
'scp '
+
username
+
'@'
+
ipaddress
+
':'
+
source
+
' '
+
destination
,
timeout
=
5
)
scp_response
=
scp_spawn
.
expect
([
'Are you sure you want to continue connecting (yes/no)?'
,
'password:'
,
pexpect
.
EOF
,
pexpect
.
TIMEOUT
])
if
scp_response
==
0
:
pass
else
:
logging
.
debug
(
'1 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
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
:
pass
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
(
'2 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
elif
scp_response
==
2
:
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
:
logging
.
debug
(
'3 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
def
copyout
(
self
,
ipaddress
,
username
,
password
,
source
,
destination
):
count
=
0
copy_status
=
False
logging
.
debug
(
'scp '
+
source
+
' '
+
username
+
'@'
+
ipaddress
+
':'
+
destination
)
scp_spawn
=
pexpect
.
spawn
(
'scp '
+
source
+
' '
+
username
+
'@'
+
ipaddress
+
':'
+
destination
,
timeout
=
5
)
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
])
while
count
<
4
:
scp_spawn
=
pexpect
.
spawn
(
'scp '
+
source
+
' '
+
username
+
'@'
+
ipaddress
+
':'
+
destination
,
timeout
=
5
)
scp_response
=
scp_spawn
.
expect
([
'Are you sure you want to continue connecting (yes/no)?'
,
'password:'
,
pexpect
.
EOF
,
pexpect
.
TIMEOUT
])
if
scp_response
==
0
:
pass
else
:
logging
.
debug
(
'1 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
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
:
pass
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
(
'2 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
elif
scp_response
==
2
:
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
:
logging
.
debug
(
'3 - scp_response = '
+
str
(
scp_response
))
sys
.
exit
(
'SCP failed'
)
def
BuildeNB
(
self
):
...
...
@@ -2061,7 +2083,7 @@ class SSHConnection():
def
CreateHtmlTabFooter
(
self
,
passStatus
):
if
((
not
self
.
htmlFooterCreated
)
and
(
self
.
htmlHeaderCreated
)):
self
.
htmlFile
.
write
(
' <tr
"
>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <th bgcolor = "#33CCFF" colspan=2>Final Tab Status</th>
\n
'
)
if
passStatus
:
self
.
htmlFile
.
write
(
' <th bgcolor = "green" colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'><font color="white">PASS <span class="glyphicon glyphicon-ok"></span> </font></th>
\n
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment