summaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ONOS/Teston/adapters/connection.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-09-05 12:30:08 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-09-05 12:30:08 +0000
commit7966eb35cc5fefcd6ca82e9d2864c0077b8a79c5 (patch)
tree1f3195af1404d6e96ab139951f97fd007c3fc2c3 /testcases/Controllers/ONOS/Teston/adapters/connection.py
parentbeb0b0c8fddbdfd45fef0a7e9548b52e48f94c45 (diff)
parent0ae5f5fc64868e8c68eb330fa5aa219abdbdfee0 (diff)
Merge "Switch print to logging.info"
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/adapters/connection.py')
-rw-r--r--testcases/Controllers/ONOS/Teston/adapters/connection.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/testcases/Controllers/ONOS/Teston/adapters/connection.py b/testcases/Controllers/ONOS/Teston/adapters/connection.py
index 16f2ef32c..b2a2e3d88 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/connection.py
+++ b/testcases/Controllers/ONOS/Teston/adapters/connection.py
@@ -16,11 +16,15 @@ Description:
import os
import pexpect
import re
+
from foundation import foundation
+import functest.utils.functest_logger as ft_logger
class connection(foundation):
+ logger = ft_logger.Logger("connection").getLogger()
+
def __init__(self):
foundation.__init__(self)
self.loginfo = foundation()
@@ -33,7 +37,7 @@ class connection(foundation):
username: login user name
password: login password
"""
- print("Now Adding an user to known hosts " + ipaddr)
+ self.logger.info("Now Adding an user to known hosts " + ipaddr)
login = handle
login.sendline("ssh -l %s -p 8101 %s" % (username, ipaddr))
index = 0
@@ -78,7 +82,7 @@ class connection(foundation):
"""
Generate ssh keys, used for some server have no sshkey.
"""
- print "Now Generating SSH keys..."
+ self.logger.info("Now Generating SSH keys...")
# Here file name may be id_rsa or id_ecdsa or others
# So here will have a judgement
keysub = handle
@@ -112,7 +116,7 @@ class connection(foundation):
parameters:
password: root login password
"""
- print("Now changing to user root")
+ self.logger.info("Now changing to user root")
login = pexpect.spawn("su - root")
index = 0
while index != 2:
@@ -129,7 +133,7 @@ class connection(foundation):
"""
Exit root user.
"""
- print("Now Release user root")
+ self.logger.info("Now Release user root")
login = pexpect.spawn("exit")
index = login.expect(['logout', pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
@@ -145,7 +149,7 @@ class connection(foundation):
parameters:
envalue: environment value to add
"""
- print "Now Adding bash environment"
+ self.logger.info("Now Adding bash environment")
fileopen = open("/etc/profile", 'r')
findContext = 1
while findContext:
@@ -165,7 +169,7 @@ class connection(foundation):
Change ONOS root path in file:bash_profile
onospath: path of onos root
"""
- print "Now Changing ONOS Root Path"
+ self.logger.info("Now Changing ONOS Root Path")
filepath = onospath + 'onos/tools/dev/bash_profile'
line = open(filepath, 'r').readlines()
lenall = len(line) - 1
@@ -175,7 +179,7 @@ class connection(foundation):
NewFile = open(filepath, 'w')
NewFile.writelines(line)
NewFile.close
- print "Done!"
+ self.logger.info("Done!")
def OnosConnectionSet(self):
"""