summaryrefslogtreecommitdiff
path: root/nics
diff options
context:
space:
mode:
authorXueqin Lin <xueqin.lin@intel.com>2016-08-11 16:56:02 +0800
committerMarvin Liu <yong.liu@intel.com>2016-08-11 17:27:14 +0800
commit2148eee64173614f09d5e926fc9dbd5cf134e895 (patch)
tree0928ee8b77821e32c30c77a9f2a26867e5afe9bf /nics
parent9599372011a060ca568d1877d65d67e8ed5c5474 (diff)
tests: add fm10k ftag test suite
FTAG is placed at the begingging of the frame, which is essential for a set of switches to behave like one switch. The case validates packet forwarding function based on FTAG, uses FTAG unit test instead of testpmd to run.
Diffstat (limited to 'nics')
-rw-r--r--nics/rrc.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/nics/rrc.py b/nics/rrc.py
index 02fe6c5..62dc8d2 100644
--- a/nics/rrc.py
+++ b/nics/rrc.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
@@ -239,3 +240,33 @@ class RedRockCanyou(NetDevice):
self.ctrl_crb.send_expect("set port config 5 max_frame_size %d" % framesize, "<0>%")
else:
self.ctrl_crb.send_expect("set port config 1 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)
+ 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
+