[dts] [PATCH 3/4] Load configuration file replace of import object

Yong Liu yong.liu at intel.com
Mon Aug 10 10:50:23 CEST 2015


From: Marvin Liu <yong.liu at intel.com>

Support configuration file based ixia options.

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

diff --git a/framework/etgen.py b/framework/etgen.py
index 1803a1f..508439b 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -33,7 +33,7 @@ import re
 import string
 import time
 import dts
-import ixiacfg
+from config import IxiaConf
 from ssh_connection import SSHConnection
 from settings import SCAPY2IXIA
 from logger import getLogger
@@ -147,16 +147,19 @@ class IxiaPacketGenerator(SSHConnection):
         self.conRelation = {}
 
         ixiaRef = self.tester.get_external_traffic_generator()
-        if ixiaRef is None or ixiaRef not in ixiacfg.ixiaPorts:
+
+        ixiacfg = IxiaConf()
+        ixiaPorts = ixiacfg.load_ixia_config()
+        if ixiaRef is None or ixiaRef not in ixiaPorts:
             return
 
-        self.ixiaVersion = ixiacfg.ixiaPorts[ixiaRef]["Version"]
-        self.ports = ixiacfg.ixiaPorts[ixiaRef]["Ports"]
+        self.ixiaVersion = ixiaPorts[ixiaRef]["Version"]
+        self.ports = ixiaPorts[ixiaRef]["Ports"]
 
         self.logger.info(self.ixiaVersion)
         self.logger.info(self.ports)
 
-        self.tclServerIP = ixiacfg.ixiaPorts[ixiaRef]["IP"]
+        self.tclServerIP = ixiaPorts[ixiaRef]["IP"]
 
         # prepare tcl shell and ixia library
         self.send_expect("tclsh", "% ")
-- 
1.9.3



More information about the dts mailing list