test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH v1] framework: allow configure login user name of DUT
Date: Wed, 26 Jul 2017 01:46:07 -0400	[thread overview]
Message-ID: <1501047967-50409-1-git-send-email-yong.liu@intel.com> (raw)

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dut.py b/framework/dut.py
index ad0d250..ffe084d 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -69,7 +69,7 @@ class Dut(Crb):
         self.tester = None
         self.cores = []
         self.architecture = None
-        self.ports_info = None
+        self.ports_info = []
         self.conf = PortConf()
         self.ports_map = []
         self.virt_pool = None
@@ -83,6 +83,7 @@ class Dut(Crb):
             self.host_session = SSHConnection(
                 self.get_ip_address(),
                 self.NAME + '_host',
+                self.get_username(),
                 self.get_password())
             self.host_session.init_log(self.logger)
             self.host_init_flag = True
@@ -177,6 +178,12 @@ class Dut(Crb):
         """
         return self.crb['pass']
 
+    def get_username(self):
+        """
+        Get DUT's login username.
+        """
+        return self.crb['user']
+
     def dut_prerequisites(self):
         """
         Prerequest function should be called before execute any test case.
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index 38ab36d..675279b 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -44,8 +44,8 @@ class SSHConnection(object):
     Implement send_expect/copy function upper SSHPexpet module.
     """
 
-    def __init__(self, host, session_name, password=''):
-        self.session = SSHPexpect(host, USERNAME, password)
+    def __init__(self, host, session_name, username, password=''):
+        self.session = SSHPexpect(host, username, password)
         self.name = session_name
         connection = {}
         connection[self.name] = self.session
diff --git a/framework/tester.py b/framework/tester.py
index 2bdd1ea..bae8e64 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -40,7 +40,7 @@ from settings import NICS, load_global_setting, PERF_SETTING
 from crb import Crb
 from net_device import GetNicObj
 from etgen import IxiaPacketGenerator, SoftwarePacketGenerator
-from settings import IXIA
+from settings import IXIA, USERNAME
 import random
 from utils import GREEN, convert_int2ip, convert_ip2int
 from exception import ParameterInvalidException
@@ -91,6 +91,12 @@ class Tester(Crb):
         """
         return self.crb['tester IP']
 
+    def get_username(self):
+        """
+        Get login username of tester CRB.
+        """
+        return USERNAME
+
     def get_password(self):
         """
         Get tester login password of tester CRB.
-- 
1.9.3

                 reply	other threads:[~2017-07-26  5:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501047967-50409-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).