[dts] [PATCH] tests ftag: add get_glortid_bymac function for Boulder Rapid

Liu, Yong yong.liu at intel.com
Tue Aug 16 03:07:43 CEST 2016


Hi Xueqin, one comment.

> -----Original Message-----
> From: xueqin.lin [mailto:xlin15 at ecsmtp.sh.intel.com]
> Sent: Monday, August 15, 2016 4:42 PM
> To: Liu, Yong; dts at dpdk.org
> Cc: Lin, Xueqin
> Subject: [dts][PATCH] tests ftag: add get_glortid_bymac function for
> Boulder Rapid
> 
> From: Xueqin Lin <xueqin.lin at 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



More information about the dts mailing list