* Re: [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid
[not found] <1471250498-20380-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
@ 2016-08-16 1:07 ` Liu, Yong
2016-08-16 5:11 ` Lin, Xueqin
0 siblings, 1 reply; 5+ messages in thread
From: Liu, Yong @ 2016-08-16 1:07 UTC (permalink / raw)
To: xueqin.lin, dts; +Cc: Lin, Xueqin
Hi Xueqin, one comment.
> -----Original Message-----
> From: xueqin.lin [mailto:xlin15@ecsmtp.sh.intel.com]
> Sent: Monday, August 15, 2016 4:42 PM
> To: Liu, Yong; dts@dpdk.org
> Cc: Lin, Xueqin
> Subject: [dts][PATCH] tests ftag: add get_glortid_bymac function for
> Boulder Rapid
>
> From: Xueqin Lin <xueqin.lin@intel.com>
>
> Enable ftag funtion 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..0151fbb 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 "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 "search none port value"
> + return None
> + else:
> + port_value = res.group(2)
> + out = self.ctrl_crb.send_expect("show stacking logical-port all",
> "<0>%",10000)
It's impossible to wait some long for expected output. Most of times, we will leave it to default value.
> + pattern = r"([0-9a-z]{6})+(\s)+(%s)+" %port_value
> + s = re.compile(pattern)
> + res = s.search(out)
> + if res is None:
> + print "search none port glort id"
> + return None
> + else:
> + port_glortid = res.group(1)
> + return port_glortid
> --
> 2.5.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid
2016-08-16 1:07 ` [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid Liu, Yong
@ 2016-08-16 5:11 ` Lin, Xueqin
0 siblings, 0 replies; 5+ messages in thread
From: Lin, Xueqin @ 2016-08-16 5:11 UTC (permalink / raw)
To: Liu, Yong, xueqin.lin, dts
OK, thanks. Will fix and send patch again.
> -----Original Message-----
> From: Liu, Yong
> Sent: Tuesday, August 16, 2016 9:08 AM
> To: xueqin.lin; dts@dpdk.org
> Cc: Lin, Xueqin
> Subject: RE: [dts][PATCH] tests ftag: add get_glortid_bymac function for
> Boulder Rapid
>
> Hi Xueqin, one comment.
>
> > -----Original Message-----
> > From: xueqin.lin [mailto:xlin15@ecsmtp.sh.intel.com]
> > Sent: Monday, August 15, 2016 4:42 PM
> > To: Liu, Yong; dts@dpdk.org
> > Cc: Lin, Xueqin
> > Subject: [dts][PATCH] tests ftag: add get_glortid_bymac function for
> > Boulder Rapid
> >
> > From: Xueqin Lin <xueqin.lin@intel.com>
> >
> > Enable ftag funtion 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..0151fbb 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 "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 "search none port value"
> > + return None
> > + else:
> > + port_value = res.group(2)
> > + out = self.ctrl_crb.send_expect("show stacking logical-port all",
> > "<0>%",10000)
> It's impossible to wait some long for expected output. Most of times, we will
> leave it to default value.
>
> > + pattern = r"([0-9a-z]{6})+(\s)+(%s)+" %port_value
> > + s = re.compile(pattern)
> > + res = s.search(out)
> > + if res is None:
> > + print "search none port glort id"
> > + return None
> > + else:
> > + port_glortid = res.group(1)
> > + return port_glortid
> > --
> > 2.5.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid
[not found] <1471508360-29089-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
@ 2016-08-19 2:57 ` Liu, Yong
0 siblings, 0 replies; 5+ messages in thread
From: Liu, Yong @ 2016-08-19 2:57 UTC (permalink / raw)
To: xueqin.lin, dts; +Cc: Xueqin Lin
Thanks, applied.
On 08/18/2016 04:19 PM, xueqin.lin wrote:
> From: Xueqin Lin <xueqin.lin@intel.com>
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid
2016-08-18 7:39 ` Liu, Yong
@ 2016-08-18 7:53 ` Lin, Xueqin
0 siblings, 0 replies; 5+ messages in thread
From: Lin, Xueqin @ 2016-08-18 7:53 UTC (permalink / raw)
To: Liu, Yong, xueqin.lin, dts
Great suggestion, will fix soon. Thanks.
> -----Original Message-----
> From: Liu, Yong
> Sent: Thursday, August 18, 2016 3:39 PM
> To: xueqin.lin; dts@dpdk.org
> Cc: Lin, Xueqin
> Subject: RE: [dts][PATCH] tests ftag: add get_glortid_bymac function for
> Boulder Rapid
>
> 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
> >
> > From: Xueqin Lin <xueqin.lin@intel.com>
> >
> > 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..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 = 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 "search none mac filter"
>
> This is error information, suggest to use "print RED(".")" to emphasize.
>
> > + 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 "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 "search none port glort id"
> > + return None
> > + else:
> > + port_glortid = res.group(1)
> > + return port_glortid
> > +
> > --
> > 2.5.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid
[not found] <1471500774-2748-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
@ 2016-08-18 7:39 ` Liu, Yong
2016-08-18 7:53 ` Lin, Xueqin
0 siblings, 1 reply; 5+ messages in thread
From: Liu, Yong @ 2016-08-18 7:39 UTC (permalink / raw)
To: xueqin.lin, dts; +Cc: Lin, Xueqin
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
>
> From: Xueqin Lin <xueqin.lin@intel.com>
>
> 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..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 = 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 "search none mac filter"
This is error information, suggest to use "print RED(".")" to emphasize.
> + 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 "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 "search none port glort id"
> + return None
> + else:
> + port_glortid = res.group(1)
> + return port_glortid
> +
> --
> 2.5.5
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-19 2:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1471250498-20380-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
2016-08-16 1:07 ` [dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid Liu, Yong
2016-08-16 5:11 ` Lin, Xueqin
[not found] <1471500774-2748-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
2016-08-18 7:39 ` Liu, Yong
2016-08-18 7:53 ` Lin, Xueqin
[not found] <1471508360-29089-1-git-send-email-xlin15@shecgisg005.sh.intel.com>
2016-08-19 2:57 ` Liu, Yong
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).