From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C80DE5954 for ; Fri, 7 Aug 2015 03:58:08 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 06 Aug 2015 18:58:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,626,1432623600"; d="scan'208";a="537470437" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by FMSMGA003.fm.intel.com with ESMTP; 06 Aug 2015 18:58:06 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by KMSMSX153.gar.corp.intel.com (172.21.73.88) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 7 Aug 2015 09:58:05 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.18]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.38]) with mapi id 14.03.0224.002; Fri, 7 Aug 2015 09:58:04 +0800 From: "Xu, HuilongX" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH 1/4] Support load crbs configuration file Thread-Index: AQHQ0ERqpOiGcRGiQ0qiWHvfpX2s/Z3/x6HQ Date: Fri, 7 Aug 2015 01:58:03 +0000 Message-ID: References: <1438864522-3699-1-git-send-email-yong.liu@intel.com> <1438864522-3699-2-git-send-email-yong.liu@intel.com> In-Reply-To: <1438864522-3699-2-git-send-email-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 1/4] Support load crbs configuration file X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2015 01:58:09 -0000 Hi yong, In crbs dict could you add key 'os'. If not os config, maybe can't support freebsd test. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > Sent: Thursday, August 06, 2015 8:35 PM > To: dts@dpdk.org > Subject: [dts] [PATCH 1/4] Support load crbs configuration file >=20 > From: Marvin Liu >=20 > Move CRBs configruations from internal python file to configuration file. >=20 > Signed-off-by: Marvin Liu >=20 > diff --git a/framework/config.py b/framework/config.py > index 65cecd4..f099a5d 100644 > --- a/framework/config.py > +++ b/framework/config.py > @@ -36,7 +36,7 @@ Generic port and crbs configuration file load function > import re > import ConfigParser # config parse module > import argparse # prase arguments module > - > +from settings import IXIA > from exception import ConfigParseException, VirtConfigParseException >=20 > PORTCONF =3D "conf/ports.cfg" > @@ -185,6 +185,58 @@ class PortConf(UserConf): > return False >=20 >=20 > +class CrbsConf(UserConf): > + DEF_CRB =3D {'IP': '', 'name': 'CrownPassCRB1', 'user': '', > + 'pass': '', 'tester IP': '', 'tester pass': '', > + IXIA: None, 'memory channels': 4, > + 'bypass core0': True} > + > + def __init__(self, crbs_conf=3DCRBCONF): > + self.config_file =3D crbs_conf > + self.crbs_cfg =3D [] > + try: > + self.crbs_conf =3D UserConf(self.config_file) > + except ConfigParseException: > + self.crbs_conf =3D None > + raise ConfigParseException > + > + def load_crbs_config(self): > + sections =3D self.crbs_conf.get_sections() > + if not sections: > + return self.crbs_cfg > + > + for name in sections: > + crb =3D self.DEF_CRB.copy() > + crb_confs =3D self.crbs_conf.load_section(name) > + if not crb_confs: > + continue > + > + # covert file configuration to dts crbs > + for conf in crb_confs: > + key, value =3D conf > + if key =3D=3D 'dut_ip': > + crb['IP'] =3D value > + elif key =3D=3D 'dut_user': > + crb['user'] =3D value > + elif key =3D=3D 'dut_passwd': > + crb['pass'] =3D value > + elif key =3D=3D 'tester_ip': > + crb['tester IP'] =3D value > + elif key =3D=3D 'tester_passwd': > + crb['tester pass'] =3D value > + elif key =3D=3D 'ixia_group': > + crb[IXIA] =3D value > + elif key =3D=3D 'channels': > + crb['memory channels'] =3D int(value) > + elif key =3D=3D 'bypass_core0': > + if value =3D=3D 'True': > + crb['bypass core0'] =3D True > + else: > + crb['bypass core0'] =3D False > + > + self.crbs_cfg.append(crb) > + return self.crbs_cfg > + > if __name__ =3D=3D '__main__': > parser =3D argparse.ArgumentParser( > description=3D"Load DTS configuration files") > @@ -218,3 +270,7 @@ if __name__ =3D=3D '__main__': > virtconf =3D VirtConf(VIRTCONF) > virtconf.load_virt_config('LIBVIRT') > print virtconf.get_virt_config() > + > + # example for crbs configuration file > + crbsconf =3D CrbsConf(CRBCONF) > + print crbsconf.load_crbs_config() > -- > 1.9.3