From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id AC6705A51 for ; Fri, 19 Aug 2016 04:54:59 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 18 Aug 2016 19:54:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,543,1464678000"; d="scan'208";a="867985869" Received: from stv-crb-56.sh.intel.com (HELO [10.239.128.116]) ([10.239.128.116]) by orsmga003.jf.intel.com with ESMTP; 18 Aug 2016 19:54:57 -0700 Message-ID: <57B67599.7040403@intel.com> Date: Fri, 19 Aug 2016 10:57:29 +0800 From: "Liu, Yong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "xueqin.lin" , dts@dpdk.org CC: Xueqin Lin References: <1471508360-29089-1-git-send-email-xlin15@shecgisg005.sh.intel.com> In-Reply-To: <1471508360-29089-1-git-send-email-xlin15@shecgisg005.sh.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Fri, 19 Aug 2016 02:55:00 -0000 Thanks, applied. On 08/18/2016 04:19 PM, xueqin.lin wrote: > From: Xueqin Lin > > Enable ftag function test on Boulder Rapid, need to strip port logic value from mac table,then strip port glort ID from stacking information. > > diff --git a/nics/br.py b/nics/br.py > index 5b6e778..79c8a7b 100644 > --- a/nics/br.py > +++ b/nics/br.py > @@ -29,6 +29,7 @@ > # (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 +244,32 @@ 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 = self.ctrl_crb.send_expect("show mac table all", "<0>%") > + pattern = r"([0-9a-f]{2}:){5}([0-9a-f]{2})" > + s = re.compile(pattern) > + res = s.search(dmac) > + if res is None: > + print RED("search none mac filter") > + return None > + else: > + mac_filter = res.group(2) > + pattern = r"(?<=%s)+([\sA-Za-z0-9/])+([0-9]{4})" %mac_filter > + s = re.compile(pattern) > + res = s.search(out) > + if res is None: > + print RED("search none port value") > + return None > + else: > + port_value = res.group(2) > + out = self.ctrl_crb.send_expect("show stacking logical-port all", "<0>%") > + pattern = r"([0-9a-z]{6})+(\s)+(%s)+" %port_value > + s = re.compile(pattern) > + res = s.search(out) > + if res is None: > + print RED("search none port glort id") > + return None > + else: > + port_glortid = res.group(1) > + return port_glortid