From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CECF65591 for ; Thu, 18 Aug 2016 09:39:38 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 18 Aug 2016 00:39:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,538,1464678000"; d="scan'208";a="1027519421" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 18 Aug 2016 00:39:17 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 18 Aug 2016 00:39:17 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 18 Aug 2016 00:39:17 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.150]) with mapi id 14.03.0248.002; Thu, 18 Aug 2016 15:39:15 +0800 From: "Liu, Yong" To: xueqin.lin , "dts@dpdk.org" CC: "Lin, Xueqin" Thread-Topic: [dts][PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid Thread-Index: AQHR+ReshHHydGC5VE6t9GuNcP9qV6BOVJkg Date: Thu, 18 Aug 2016 07:39:15 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E22270566@SHSMSX103.ccr.corp.intel.com> References: <1471500774-2748-1-git-send-email-xlin15@shecgisg005.sh.intel.com> In-Reply-To: <1471500774-2748-1-git-send-email-xlin15@shecgisg005.sh.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2UxOWExY2QtYWRlNC00ZjRhLWI4MjktODhiNzJmNzYzZTRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjdSTFpJQm91aDdtQmhUY1RmdTVvMjhmTGF3TUxuWENNS280aHF6TUQ2R2M9In0= x-ctpclassification: CTP_IC 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] tests ftag: add get_glortid_bymac function for Boulder Rapid 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: Thu, 18 Aug 2016 07:39:39 -0000 Thanks Xueqin, one comment. > -----Original Message----- > From: xueqin.lin [mailto:xlin15@ecsmtp.sh.intel.com] > Sent: Thursday, August 18, 2016 2:13 PM > To: Liu, Yong; dts@dpdk.org > Cc: Lin, Xueqin > Subject: [dts][PATCH] tests ftag: add get_glortid_bymac function for > Boulder Rapid >=20 > From: Xueqin Lin >=20 > Enable ftag function test on Boulder Rapid, need to strip port logic valu= e > from mac table, > then strip port glort ID from stacking information. >=20 > diff --git a/nics/br.py b/nics/br.py > index 5b6e778..140d367 100644 > --- a/nics/br.py > +++ b/nics/br.py > @@ -28,7 +28,7 @@ > # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > - > +import re > from crb import Crb > from config import PortConf, PORTCONF > from exception import PortConfigParseException > @@ -243,3 +243,33 @@ class BoulderRapid(NetDevice): > self.ctrl_crb.send_expect("set port config 1 > max_frame_size %d" % framesize, "<0>%") > else: > self.ctrl_crb.send_expect("set port config 5 > max_frame_size %d" % framesize, "<0>%") > + > + def get_glortid_bymac(self, dmac): > + out =3D self.ctrl_crb.send_expect("show mac table all", "<0>%") > + pattern =3D r"([0-9a-f]{2}:){5}([0-9a-f]{2})" > + s =3D re.compile(pattern) > + res =3D s.search(dmac) > + if res is None: > + print "search none mac filter" This is error information, suggest to use "print RED(".")" to emphasize. > + return None > + else: > + mac_filter =3D res.group(2) > + pattern =3D r"(?<=3D%s)+([\sA-Za-z0-9/])+([0-9]{4})" %mac_filter > + s =3D re.compile(pattern) > + res =3D s.search(out) > + if res is None: > + print "search none port value" > + return None > + else: > + port_value =3D res.group(2) > + out =3D self.ctrl_crb.send_expect("show stacking logical-port al= l", > "<0>%") > + pattern =3D r"([0-9a-z]{6})+(\s)+(%s)+" %port_value > + s =3D re.compile(pattern) > + res =3D s.search(out) > + if res is None: > + print "search none port glort id" > + return None > + else: > + port_glortid =3D res.group(1) > + return port_glortid > + > -- > 2.5.5