test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 0/5] Support IXIA performance validation on one platform
@ 2015-02-12  8:09 Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

This patch support configure IXIA port as tester peer port. Thus will allow 
us to run IXIA performance test on one platform.

Removed useless multiple nic types, DTS will support different type nics by 
port configuration.

Yong Liu (5):
  framework: remove useless nic list, replaced by port configuration
    file
  framework: support configure IXIA port as tester peer port
  framework: seperate killl scapy and kill DPDK application in kill_all
    function
  framework: optimize wirespeed calculation and kill_all function
  pmd: remove useless nic check function

 conf/ports.cfg         |  6 ++++--
 framework/crb.py       |  1 -
 framework/dts.py       | 30 ++++++++++++++---------------
 framework/dut.py       | 41 +++++++++++++++++----------------------
 framework/etgen.py     | 52 ++++++++++++++++++++++++++++----------------------
 framework/test_case.py | 26 +++++++++++++++++++------
 framework/tester.py    | 14 ++++++++++----
 tests/TestSuite_pmd.py | 17 -----------------
 8 files changed, 95 insertions(+), 92 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
@ 2015-02-12  8:09 ` Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 2/5] framework: support configure IXIA port as tester peer port Yong Liu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/dts.py | 30 ++++++++++++++----------------
 framework/dut.py | 41 ++++++++++++++++++-----------------------
 2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/framework/dts.py b/framework/dts.py
index bddbe33..871380b 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -64,7 +64,7 @@ results_table_rows = []
 results_table_header = []
 performance_only = False
 functional_only = False
-nics = None
+nic = None
 requested_tests = None
 dut = None
 tester = None
@@ -151,13 +151,12 @@ def accepted_nic(pci_id):
     if pci_id not in NICS.values():
         return False
 
-    if 'any' in nics:
+    if 'any' in nic:
         return True
 
     else:
-        for selected_nic in nics:
-            if pci_id == NICS[selected_nic]:
-                return True
+        if pci_id == NICS[nic]:
+            return True
 
     return False
 
@@ -211,9 +210,9 @@ def dts_parse_config(section):
         if suite == '':
             test_suites.remove(suite)
 
-    nics = [_.strip() for _ in paramDict['nic_type'].split(',')]
+    nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0]
 
-    return duts[0], targets, test_suites, nics
+    return duts[0], targets, test_suites, nic
 
 
 def get_project_obj(project_name, super_class, crbInst, serializer):
@@ -267,7 +266,7 @@ def dts_log_execution(log_handler):
         pass
 
 
-def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
+def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic):
     """
     Create dts dut/tester instance and initialize them.
     """
@@ -282,7 +281,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
     tester.dut = dut
     dut.set_speedup_options(read_cache, skip_setup)
     dut.set_directory(base_dir)
-    dut.set_nic_types(nics)
+    dut.set_nic_type(nic)
     tester.set_speedup_options(read_cache, skip_setup)
     show_speedup_options_messages(read_cache, skip_setup)
     dut.set_test_types(func_tests=functional_only, perf_tests=performance_only)
@@ -315,7 +314,7 @@ def dts_run_prerequisties(pkgName, patch):
         return False
 
 
-def dts_run_target(crbInst, targets, test_suites, nics):
+def dts_run_target(crbInst, targets, test_suites, nic):
     """
     Run each target in execution targets.
     """
@@ -336,8 +335,7 @@ def dts_run_target(crbInst, targets, test_suites, nics):
 
         if 'nic_type' not in paramDict:
             paramDict['nic_type'] = 'any'
-            nics = ['any']
-        nic = nics[0]
+            nic = ['any']
         result.nic = nic
 
         dts_run_suite(crbInst, test_suites, target, nic)
@@ -394,7 +392,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
     global config
     global serializer
-    global nics
+    global nic
     global requested_tests
     global result
     global excel_report
@@ -446,7 +444,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
         dts_parse_param(section)
 
         # verify if the delimiter is good if the lists are vertical
-        dutIP, targets, test_suites, nics = dts_parse_config(section)
+        dutIP, targets, test_suites, nic = dts_parse_config(section)
 
         log_handler.info("\nDUT " + dutIP)
 
@@ -465,14 +463,14 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
         result.dut = dutIP
 
         # init dut, tester crb
-        dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics)
+        dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic)
 
         # Run DUT prerequisites
         if dts_run_prerequisties(pkgName, patch) is False:
             dts_crbs_exit()
             continue
 
-        dts_run_target(crbInst, targets, test_suites, nics)
+        dts_run_target(crbInst, targets, test_suites, nic)
 
         dts_crbs_exit()
 
diff --git a/framework/dut.py b/framework/dut.py
index e095d86..034a915 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -80,12 +80,12 @@ class Dut(Crb):
         self.send_expect("sed -i 's/%s=.*$/%s=%s/'  config/defconfig_%s" %
                          (parameter, parameter, value, target), "# ")
 
-    def set_nic_types(self, nics):
+    def set_nic_type(self, nic):
         """
         Set CRB NICS ready to validated.
         """
-        self.nics = nics
-        if 'cfg' in nics:
+        self.nic = nic
+        if 'cfg' in nic:
             self.conf.load_ports_config(self.get_ip_address())
 
     def set_toolchain(self, target):
@@ -304,11 +304,9 @@ class Dut(Crb):
             perf = self.want_perf_tests
 
         nictypes = []
-        if nic_type == 'any' and perf:
-            return ports
 
         for nic in NICS.keys():
-            if ('any' == nic_type) or (nic_type in nic):
+            if ('any' == nic_type) or ('cfg' == nic_type):
                 nictypes.append(nic)
 
         for portid in range(len(self.ports_info)):
@@ -427,20 +425,17 @@ class Dut(Crb):
         Check that whether auto scanned ports ready to use
         """
         pci_addr = "%s:%s" % (pci_bus, pci_id)
-        codenames = []
-        for nic in self.nics:
-            if nic == 'any':
-                return True
-            elif nic == 'cfg':
-                if self.conf.check_port_available(pci_bus) is True:
-                    return True
-            elif nic not in NICS.keys():
-                self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)
-            else:
-                codenames.append(NICS[nic])
-
-        if pci_id in codenames:
+        if self.nic == 'any':
             return True
+        elif self.nic == 'cfg':
+            if self.conf.check_port_available(pci_bus) is True:
+                return True
+        elif self.nic not in NICS.keys():
+            self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic)
+        else:
+            codename = NICS[self.nic]
+            if pci_id == codename:
+                return True
 
         return False
 
@@ -482,8 +477,6 @@ class Dut(Crb):
             self.scan_ports_uncached()
             self.serializer.save(self.PORT_INFO_CACHE_KEY, self.ports_info)
 
-        self.logger.info(dts.pprint(self.ports_info))
-
     def scan_ports_uncached(self):
         """
         Scan ports and collect port's pci id, mac adress, ipv6 address.
@@ -569,8 +562,10 @@ class Dut(Crb):
             else:
                 port_cfg = {}
 
-            for key in ['intf', 'mac', 'numa', 'peer']:
+            for key in ['intf', 'mac', 'numa', 'peer', 'source']:
                 if key in port_cfg:
                     if key in port and port_cfg[key] != port[key]:
-                        self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
+                        self.logger.warning("CONFIGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
                     port[key] = port_cfg[key]
+
+        self.logger.info(dts.pprint(self.ports_info))
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH 2/5] framework: support configure IXIA port as tester peer port
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
@ 2015-02-12  8:09 ` Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 conf/ports.cfg     |  6 ++++--
 framework/etgen.py | 52 +++++++++++++++++++++++++++++-----------------------
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/conf/ports.cfg b/conf/ports.cfg
index eb2cb34..43cab27 100644
--- a/conf/ports.cfg
+++ b/conf/ports.cfg
@@ -3,7 +3,9 @@
 # ports=
 #     pci=Pci BDF,intf=Kernel interface;
 #     pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa 
+#     pci=Pci BDF,peer=IXIA:card.port
 [DUT IP]
-ports = 
+ports =
     pci=XX:XX.X,intf=eth0;
-    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
+    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0;
+    pci=ZZ:ZZ.Y,peer=IXIA:X.Y
diff --git a/framework/etgen.py b/framework/etgen.py
index f2da4ab..e022820 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -112,7 +112,7 @@ class SoftwarePacketGenerator():
 
         self.tester.send_expect("stop all", "Pktgen>")
         self.tester.send_expect("quit", "# ")
-        self.tester.kill_all()
+        self.tester.kill_all(killall = True)
         self.tester.restore_interfaces()
 
         return rx_bps, tx_bps, rx_pps
@@ -385,13 +385,13 @@ class IxiaPacketGenerator(SSHConnection):
                          string.join(['[list %d %d %d]' %
                                       (self.chasId, item['card'], item['port']) for item in pList], ' '))
 
-    def send_ping6(self, intf, mac, ipv6):
+    def send_ping6(self, pci, mac, ipv6):
         """
         Send ping6 packet from IXIA ports.
         """
         self.send_expect("source ./ixTcl1.0/ixiaPing6.tcl", "% ")
         out = self.send_expect('ping6 "%s" "%s" %d %d %d' %
-                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.interface_to_port(intf)['card'], self.interface_to_port(intf)['port']), "% ", 90)
+                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.pci_to_port(pci)['card'], self.pci_to_port(pci)['port']), "% ", 90)
         return out
 
     def ipv6_to_tcl_format(self, ipv6):
@@ -424,14 +424,19 @@ class IxiaPacketGenerator(SSHConnection):
             return plist
 
         for p in self.ports:
-            plist.append({'type': 'ixia', 'intf': '%d.%d' % (p['card'], p['port'])})
+            plist.append({'type': 'ixia', 'pci': 'IXIA:%d.%d' % (p['card'], p['port'])})
         return plist
 
-    def interface_to_port(self, intf):
-        """
-        Convert IXIA interface to IXIA port.
-        """
-        return {'card': int(intf.split('.')[0]), 'port': int(intf.split('.')[1])}
+    def pci_to_port(self, pci):
+         """
+         Convert IXIA fake pci to IXIA port.
+         """
+         ixia_pci_regex = "IXIA:(\d).(\d)"
+         m = re.match(ixia_pci_regex, pci)
+         if m is None:
+             return {'card': -1, 'port': -1}
+ 
+         return {'card': int(m.group(1)), 'port': int(m.group(2))}
 
     def loss(self, portList, ratePercent):
         """
@@ -539,19 +544,19 @@ class IxiaPacketGenerator(SSHConnection):
             rxPortlist.add(rxPort)
 
         # port init
-        self.config_port([self.interface_to_port(
-            self.tester.get_interface(port)) for port in txPortlist.union(rxPortlist)])
+        self.config_port([self.pci_to_port(
+            self.tester.get_pci(port)) for port in txPortlist.union(rxPortlist)])
 
         # stream/flow setting
         for (txPort, rxPort, pcapFile) in portList:
-            self.config_stream(pcapFile, self.interface_to_port(self.tester.get_interface(txPort)), rate_percent, 1, latency)
+            self.config_stream(pcapFile, self.pci_to_port(self.tester.get_pci(txPort)), rate_percent, 1, latency)
 
         # config stream before packetGroup
         if latency is not False:
             for (txPort, rxPort, pcapFile) in portList:
                 flow_num = len(self.parse_pcap(pcapFile))
-                self.config_pktGroup_rx(self.interface_to_port(self.tester.get_interface(rxPort)))
-                self.config_pktGroup_tx(self.interface_to_port(self.tester.get_interface(txPort)))
+                self.config_pktGroup_rx(self.pci_to_port(self.tester.get_pci(rxPort)))
+                self.config_pktGroup_tx(self.pci_to_port(self.tester.get_pci(txPort)))
         return rxPortlist, txPortlist
 
     def prepare_ixia_for_transmission(self, txPortlist, rxPortlist):
@@ -559,12 +564,12 @@ class IxiaPacketGenerator(SSHConnection):
         Clear all statistics and implement configuration to IXIA hareware.
         """
         self.add_tcl_cmd("ixClearStats portList")
-        self.set_ixia_port_list([self.interface_to_port(self.tester.get_interface(port)) for port in txPortlist])
+        self.set_ixia_port_list([self.pci_to_port(self.tester.get_pci(port)) for port in txPortlist])
         self.add_tcl_cmd("ixWriteConfigToHardware portList")
         for port in txPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
         for port in rxPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
 
     def get_transmission_results(self, rx_port_list, tx_port_list, delay=5):
         """
@@ -574,6 +579,7 @@ class IxiaPacketGenerator(SSHConnection):
         time.sleep(delay)
         bpsRate = 0
         rate = 0
+        oversize = 0
         for port in rx_port_list:
             self.stat_get_rate_stat_all_stats(port)
             out = self.send_expect("stat cget -framesReceived", '%', 10)
@@ -619,7 +625,7 @@ class IxiaPacketGenerator(SSHConnection):
         Get the connect relations between DUT and Ixia.
         """
         for port in dutPorts:
-            info = self.tester.get_interface(self.tester.get_local_port(port)).split('.')
+            info = self.tester.get_pci(self.tester.get_local_port(port)).split('.')
             self.conRelation[port] = [int(info[0]), int(info[1]), repr(self.tester.dut.get_mac_address(port).replace(':', ' ').upper())]
         return self.conRelation
 
@@ -656,7 +662,7 @@ class IxiaPacketGenerator(SSHConnection):
         Stop Packet Group operation on port and get current Packet Group
         statistics on port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         self.send_expect("ixStopPortPacketGroups %d %d %d" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats get %d %d %d 0 16384" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats getGroup 0", "%", 100)
@@ -674,7 +680,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Sends a IXIA TCL command to obtain all the stat values on a given port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat get statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 10)
@@ -683,7 +689,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to prepare the internal buffers were the frames were captured.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'capture get {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -692,7 +698,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         All statistics of specified IXIA port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat getRate statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -702,7 +708,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to load the captured frames into the internal buffers.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'captureBuffer get {0} {1} {2} {3} {4}'
         command = command.format(self.chasId, port['card'], port['port'],
                                  first_frame, last_frame)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 2/5] framework: support configure IXIA port as tester peer port Yong Liu
@ 2015-02-12  8:09 ` Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 4/5] framework: optimize wirespeed calculation and " Yong Liu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/tester.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/framework/tester.py b/framework/tester.py
index 68fec69..bdd039a 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -148,6 +148,12 @@ class Tester(Crb):
         """
         return self.ports_info[self.get_local_port(remotePort)]['type']
 
+    def get_pci(self, localPort):
+        """
+        Return tester local port pci id.
+        """
+        return self.ports_info[localPort]['pci']
+
     def get_interface(self, localPort):
         """
         Return tester local port interface name.
@@ -250,7 +256,7 @@ class Tester(Crb):
         Send ping6 packet from local port with destination ipv6 address.
         """
         if self.ports_info[localPort]['type'] == 'ixia':
-            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['intf'], mac, ipv6)
+            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['pci'], mac, ipv6)
         else:
             return self.send_expect("ping6 -w 5 -c 5 -A -I %s %s" % (self.ports_info[localPort]['intf'], ipv6), "# ", 10)
 
@@ -449,13 +455,13 @@ class Tester(Crb):
             instance.__dict__ = self.ixia_packet_gen.__dict__
             instance.__dict__.update(current_attrs)
 
-    def kill_all(self):
+    def kill_all(self, killall=False):
         """
-        Kill all scapy process and DPDK applications on tester.
+        Kill all scapy process or DPDK application on tester.
         """
         if not self.has_external_traffic_generator():
             self.alt_session.send_expect('killall scapy 2>/dev/null; echo tester', '# ', 5)
-        else:
+        if killall:
             super(Tester, self).kill_all()
 
     def close(self):
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH 4/5] framework: optimize wirespeed calculation and kill_all function
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
                   ` (2 preceding siblings ...)
  2015-02-12  8:09 ` [dts] [PATCH 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
@ 2015-02-12  8:09 ` Yong Liu
  2015-02-12  8:09 ` [dts] [PATCH 5/5] pmd: remove useless nic check function Yong Liu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/crb.py       |  1 -
 framework/test_case.py | 26 ++++++++++++++++++++------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index fa03757..fb3639c 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -284,7 +284,6 @@ class Crb(object):
                 | awk '/config/ {print $2}'` ; do kill -9 $i; done"
         self.alt_session.session.send_expect(cmd, "# ", 10)
         time.sleep(.7)
-        self.check_os_type()
 
     def close(self):
         """
diff --git a/framework/test_case.py b/framework/test_case.py
index c5dd10f..fbde06c 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -33,9 +33,9 @@
 A base class for creating DTF test cases.
 """
 
+import dts
 from exception import VerifyFailure
-from settings import DRIVERS
-
+from settings import DRIVERS, NICS
 
 class TestCase(object):
 
@@ -67,18 +67,32 @@ class TestCase(object):
 
         raise ValueError(nic_name)
 
+    def get_nic_name(self, pci_id):
+        for nic_name, pci in NICS.items():
+            if pci_id == pci:
+                return nic_name
+
+        raise ValueError(nic_name)
+
     def wirespeed(self, nic, frame_size, num_ports):
         """
         Calculate bit rate. It is depended for NICs
         """
         bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
-        if self.get_nic_driver(self.nic) == "ixgbe":
+        if self.nic == "any" or self.nic == "cfg":
+            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
+            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
+        else:
+            driver = self.get_nic_driver(self.nic)
+            nic = self.nic
+
+        if driver == "ixgbe":
             bitrate *= 10  # 10 Gb NICs
-        elif self.nic == "avoton2c5":
+        elif nic == "avoton2c5":
             bitrate *= 2.5  # 2.5 Gb NICs
-        elif self.nic in ["fortville_spirit", "fortville_spirit_single"]:
+        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
             bitrate *= 40
-        elif self.nic == 'fortville_eagle':
+        elif nic == 'fortville_eagle':
            bitrate *= 10
 
         return bitrate * num_ports / 8 / (frame_size + 20)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH 5/5] pmd: remove useless nic check function
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
                   ` (3 preceding siblings ...)
  2015-02-12  8:09 ` [dts] [PATCH 4/5] framework: optimize wirespeed calculation and " Yong Liu
@ 2015-02-12  8:09 ` Yong Liu
  2015-02-12  9:08 ` [dts] [PATCH 0/5] Support IXIA performance validation on one platform Qiu, Michael
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-12  8:09 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 tests/TestSuite_pmd.py | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index c5b7e3b..7acf937 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -92,28 +92,11 @@ class TestPmd(TestCase):
             self.table_header.append("%s Mpps" % test_cycle['cores'])
             self.table_header.append("% linerate")
 
-        self.needed_ports = {"niantic": 2,
-                             "kawela_2": 2,
-                             "bartonhills": 4,
-                             "82545EM": 2,
-                             "82540EM": 2,
-                             "I217V": 1,
-                             "I217LM": 1,
-                             "I218V": 1,
-                             "I218LM": 1}
-
         self.blacklist = ""
 
-        self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", "82540EM", "I217V", "I217LM", "I218V", "I218LM"],
-                    "NIC Unsupported: " + str(self.nic))
-
         # Based on h/w type, choose how many ports to use
         self.dut_ports = self.dut.get_ports()
 
-        # Verify that enough ports are available
-        self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
-                    "Insufficient ports for speed testing")
-
         self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[
             'ip'] + HEADER_SIZE['udp']
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dts] [PATCH 0/5] Support IXIA performance validation on one platform
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
                   ` (4 preceding siblings ...)
  2015-02-12  8:09 ` [dts] [PATCH 5/5] pmd: remove useless nic check function Yong Liu
@ 2015-02-12  9:08 ` Qiu, Michael
  2015-02-13  0:44   ` Liu, Yong
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
  7 siblings, 1 reply; 21+ messages in thread
From: Qiu, Michael @ 2015-02-12  9:08 UTC (permalink / raw)
  To: Liu, Yong, dts

Could you please add some commit log for each patch?

commit log could help me to understand the patch especially the code.

Thanks,
Michael

On 2/12/2015 4:09 PM, Yong Liu wrote:
> This patch support configure IXIA port as tester peer port. Thus will allow 
> us to run IXIA performance test on one platform.
>
> Removed useless multiple nic types, DTS will support different type nics by 
> port configuration.
>
> Yong Liu (5):
>   framework: remove useless nic list, replaced by port configuration
>     file
>   framework: support configure IXIA port as tester peer port
>   framework: seperate killl scapy and kill DPDK application in kill_all
>     function
>   framework: optimize wirespeed calculation and kill_all function
>   pmd: remove useless nic check function
>
>  conf/ports.cfg         |  6 ++++--
>  framework/crb.py       |  1 -
>  framework/dts.py       | 30 ++++++++++++++---------------
>  framework/dut.py       | 41 +++++++++++++++++----------------------
>  framework/etgen.py     | 52 ++++++++++++++++++++++++++++----------------------
>  framework/test_case.py | 26 +++++++++++++++++++------
>  framework/tester.py    | 14 ++++++++++----
>  tests/TestSuite_pmd.py | 17 -----------------
>  8 files changed, 95 insertions(+), 92 deletions(-)
>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dts] [PATCH 0/5] Support IXIA performance validation on one platform
  2015-02-12  9:08 ` [dts] [PATCH 0/5] Support IXIA performance validation on one platform Qiu, Michael
@ 2015-02-13  0:44   ` Liu, Yong
  0 siblings, 0 replies; 21+ messages in thread
From: Liu, Yong @ 2015-02-13  0:44 UTC (permalink / raw)
  To: Qiu, Michael, dts

Sure, I'll add comments for these patches.

> -----Original Message-----
> From: Qiu, Michael
> Sent: Thursday, February 12, 2015 5:09 PM
> To: Liu, Yong; dts@dpdk.org
> Subject: Re: [dts] [PATCH 0/5] Support IXIA performance validation on one
> platform
> 
> Could you please add some commit log for each patch?
> 
> commit log could help me to understand the patch especially the code.
> 
> Thanks,
> Michael
> 
> On 2/12/2015 4:09 PM, Yong Liu wrote:
> > This patch support configure IXIA port as tester peer port. Thus will
> allow
> > us to run IXIA performance test on one platform.
> >
> > Removed useless multiple nic types, DTS will support different type nics
> by
> > port configuration.
> >
> > Yong Liu (5):
> >   framework: remove useless nic list, replaced by port configuration
> >     file
> >   framework: support configure IXIA port as tester peer port
> >   framework: seperate killl scapy and kill DPDK application in kill_all
> >     function
> >   framework: optimize wirespeed calculation and kill_all function
> >   pmd: remove useless nic check function
> >
> >  conf/ports.cfg         |  6 ++++--
> >  framework/crb.py       |  1 -
> >  framework/dts.py       | 30 ++++++++++++++---------------
> >  framework/dut.py       | 41 +++++++++++++++++----------------------
> >  framework/etgen.py     | 52 ++++++++++++++++++++++++++++---------------
> -------
> >  framework/test_case.py | 26 +++++++++++++++++++------
> >  framework/tester.py    | 14 ++++++++++----
> >  tests/TestSuite_pmd.py | 17 -----------------
> >  8 files changed, 95 insertions(+), 92 deletions(-)
> >

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
                   ` (5 preceding siblings ...)
  2015-02-12  9:08 ` [dts] [PATCH 0/5] Support IXIA performance validation on one platform Qiu, Michael
@ 2015-02-13  2:14 ` Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
                     ` (5 more replies)
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
  7 siblings, 6 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

This patch support configure IXIA port as tester peer port. Thus will allow 
us to run IXIA performance test on one platform.
Removed useless multiple nic types, DTS will support different types nics by 
port configuration.

Yong Liu (5):
  framework: remove useless nic list, replaced by port configuration
    file
  framework: support configure IXIA port as tester peer port
  framework: seperate killl scapy and kill DPDK application in kill_all
    function
  framework: optimize wirespeed calculation and kill_all function
  pmd: remove useless nic check function

 conf/ports.cfg         |  6 ++++--
 framework/crb.py       |  1 -
 framework/dts.py       | 30 ++++++++++++++---------------
 framework/dut.py       | 41 +++++++++++++++++----------------------
 framework/etgen.py     | 52 ++++++++++++++++++++++++++++----------------------
 framework/test_case.py | 26 +++++++++++++++++++------
 framework/tester.py    | 14 ++++++++++----
 tests/TestSuite_pmd.py | 17 -----------------
 8 files changed, 95 insertions(+), 92 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
@ 2015-02-13  2:14   ` Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 2/5] framework: support configure IXIA port as tester peer port Yong Liu
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

DTS used to support different types of nic by parameter nic_type. But in the 
process of running, DTS only take first four ports for validation. This may 
be cause confusion.

Removed these logic for multi nic will be supported by port configuration 
file. In execution.cfg will only parse the first nic_type now.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/dts.py | 30 ++++++++++++++----------------
 framework/dut.py | 41 ++++++++++++++++++-----------------------
 2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/framework/dts.py b/framework/dts.py
index bddbe33..871380b 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -64,7 +64,7 @@ results_table_rows = []
 results_table_header = []
 performance_only = False
 functional_only = False
-nics = None
+nic = None
 requested_tests = None
 dut = None
 tester = None
@@ -151,13 +151,12 @@ def accepted_nic(pci_id):
     if pci_id not in NICS.values():
         return False
 
-    if 'any' in nics:
+    if 'any' in nic:
         return True
 
     else:
-        for selected_nic in nics:
-            if pci_id == NICS[selected_nic]:
-                return True
+        if pci_id == NICS[nic]:
+            return True
 
     return False
 
@@ -211,9 +210,9 @@ def dts_parse_config(section):
         if suite == '':
             test_suites.remove(suite)
 
-    nics = [_.strip() for _ in paramDict['nic_type'].split(',')]
+    nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0]
 
-    return duts[0], targets, test_suites, nics
+    return duts[0], targets, test_suites, nic
 
 
 def get_project_obj(project_name, super_class, crbInst, serializer):
@@ -267,7 +266,7 @@ def dts_log_execution(log_handler):
         pass
 
 
-def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
+def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic):
     """
     Create dts dut/tester instance and initialize them.
     """
@@ -282,7 +281,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
     tester.dut = dut
     dut.set_speedup_options(read_cache, skip_setup)
     dut.set_directory(base_dir)
-    dut.set_nic_types(nics)
+    dut.set_nic_type(nic)
     tester.set_speedup_options(read_cache, skip_setup)
     show_speedup_options_messages(read_cache, skip_setup)
     dut.set_test_types(func_tests=functional_only, perf_tests=performance_only)
@@ -315,7 +314,7 @@ def dts_run_prerequisties(pkgName, patch):
         return False
 
 
-def dts_run_target(crbInst, targets, test_suites, nics):
+def dts_run_target(crbInst, targets, test_suites, nic):
     """
     Run each target in execution targets.
     """
@@ -336,8 +335,7 @@ def dts_run_target(crbInst, targets, test_suites, nics):
 
         if 'nic_type' not in paramDict:
             paramDict['nic_type'] = 'any'
-            nics = ['any']
-        nic = nics[0]
+            nic = ['any']
         result.nic = nic
 
         dts_run_suite(crbInst, test_suites, target, nic)
@@ -394,7 +392,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
     global config
     global serializer
-    global nics
+    global nic
     global requested_tests
     global result
     global excel_report
@@ -446,7 +444,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
         dts_parse_param(section)
 
         # verify if the delimiter is good if the lists are vertical
-        dutIP, targets, test_suites, nics = dts_parse_config(section)
+        dutIP, targets, test_suites, nic = dts_parse_config(section)
 
         log_handler.info("\nDUT " + dutIP)
 
@@ -465,14 +463,14 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
         result.dut = dutIP
 
         # init dut, tester crb
-        dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics)
+        dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic)
 
         # Run DUT prerequisites
         if dts_run_prerequisties(pkgName, patch) is False:
             dts_crbs_exit()
             continue
 
-        dts_run_target(crbInst, targets, test_suites, nics)
+        dts_run_target(crbInst, targets, test_suites, nic)
 
         dts_crbs_exit()
 
diff --git a/framework/dut.py b/framework/dut.py
index e095d86..034a915 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -80,12 +80,12 @@ class Dut(Crb):
         self.send_expect("sed -i 's/%s=.*$/%s=%s/'  config/defconfig_%s" %
                          (parameter, parameter, value, target), "# ")
 
-    def set_nic_types(self, nics):
+    def set_nic_type(self, nic):
         """
         Set CRB NICS ready to validated.
         """
-        self.nics = nics
-        if 'cfg' in nics:
+        self.nic = nic
+        if 'cfg' in nic:
             self.conf.load_ports_config(self.get_ip_address())
 
     def set_toolchain(self, target):
@@ -304,11 +304,9 @@ class Dut(Crb):
             perf = self.want_perf_tests
 
         nictypes = []
-        if nic_type == 'any' and perf:
-            return ports
 
         for nic in NICS.keys():
-            if ('any' == nic_type) or (nic_type in nic):
+            if ('any' == nic_type) or ('cfg' == nic_type):
                 nictypes.append(nic)
 
         for portid in range(len(self.ports_info)):
@@ -427,20 +425,17 @@ class Dut(Crb):
         Check that whether auto scanned ports ready to use
         """
         pci_addr = "%s:%s" % (pci_bus, pci_id)
-        codenames = []
-        for nic in self.nics:
-            if nic == 'any':
-                return True
-            elif nic == 'cfg':
-                if self.conf.check_port_available(pci_bus) is True:
-                    return True
-            elif nic not in NICS.keys():
-                self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)
-            else:
-                codenames.append(NICS[nic])
-
-        if pci_id in codenames:
+        if self.nic == 'any':
             return True
+        elif self.nic == 'cfg':
+            if self.conf.check_port_available(pci_bus) is True:
+                return True
+        elif self.nic not in NICS.keys():
+            self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic)
+        else:
+            codename = NICS[self.nic]
+            if pci_id == codename:
+                return True
 
         return False
 
@@ -482,8 +477,6 @@ class Dut(Crb):
             self.scan_ports_uncached()
             self.serializer.save(self.PORT_INFO_CACHE_KEY, self.ports_info)
 
-        self.logger.info(dts.pprint(self.ports_info))
-
     def scan_ports_uncached(self):
         """
         Scan ports and collect port's pci id, mac adress, ipv6 address.
@@ -569,8 +562,10 @@ class Dut(Crb):
             else:
                 port_cfg = {}
 
-            for key in ['intf', 'mac', 'numa', 'peer']:
+            for key in ['intf', 'mac', 'numa', 'peer', 'source']:
                 if key in port_cfg:
                     if key in port and port_cfg[key] != port[key]:
-                        self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
+                        self.logger.warning("CONFIGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
                     port[key] = port_cfg[key]
+
+        self.logger.info(dts.pprint(self.ports_info))
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 2/5] framework: support configure IXIA port as tester peer port
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
@ 2015-02-13  2:14   ` Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

Now we can specify DUT's IXIA port id in port configuration file. Now can run 
performance validation with only one DUT.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 conf/ports.cfg     |  6 ++++--
 framework/etgen.py | 52 +++++++++++++++++++++++++++++-----------------------
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/conf/ports.cfg b/conf/ports.cfg
index eb2cb34..43cab27 100644
--- a/conf/ports.cfg
+++ b/conf/ports.cfg
@@ -3,7 +3,9 @@
 # ports=
 #     pci=Pci BDF,intf=Kernel interface;
 #     pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa 
+#     pci=Pci BDF,peer=IXIA:card.port
 [DUT IP]
-ports = 
+ports =
     pci=XX:XX.X,intf=eth0;
-    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
+    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0;
+    pci=ZZ:ZZ.Y,peer=IXIA:X.Y
diff --git a/framework/etgen.py b/framework/etgen.py
index f2da4ab..e022820 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -112,7 +112,7 @@ class SoftwarePacketGenerator():
 
         self.tester.send_expect("stop all", "Pktgen>")
         self.tester.send_expect("quit", "# ")
-        self.tester.kill_all()
+        self.tester.kill_all(killall = True)
         self.tester.restore_interfaces()
 
         return rx_bps, tx_bps, rx_pps
@@ -385,13 +385,13 @@ class IxiaPacketGenerator(SSHConnection):
                          string.join(['[list %d %d %d]' %
                                       (self.chasId, item['card'], item['port']) for item in pList], ' '))
 
-    def send_ping6(self, intf, mac, ipv6):
+    def send_ping6(self, pci, mac, ipv6):
         """
         Send ping6 packet from IXIA ports.
         """
         self.send_expect("source ./ixTcl1.0/ixiaPing6.tcl", "% ")
         out = self.send_expect('ping6 "%s" "%s" %d %d %d' %
-                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.interface_to_port(intf)['card'], self.interface_to_port(intf)['port']), "% ", 90)
+                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.pci_to_port(pci)['card'], self.pci_to_port(pci)['port']), "% ", 90)
         return out
 
     def ipv6_to_tcl_format(self, ipv6):
@@ -424,14 +424,19 @@ class IxiaPacketGenerator(SSHConnection):
             return plist
 
         for p in self.ports:
-            plist.append({'type': 'ixia', 'intf': '%d.%d' % (p['card'], p['port'])})
+            plist.append({'type': 'ixia', 'pci': 'IXIA:%d.%d' % (p['card'], p['port'])})
         return plist
 
-    def interface_to_port(self, intf):
-        """
-        Convert IXIA interface to IXIA port.
-        """
-        return {'card': int(intf.split('.')[0]), 'port': int(intf.split('.')[1])}
+    def pci_to_port(self, pci):
+         """
+         Convert IXIA fake pci to IXIA port.
+         """
+         ixia_pci_regex = "IXIA:(\d).(\d)"
+         m = re.match(ixia_pci_regex, pci)
+         if m is None:
+             return {'card': -1, 'port': -1}
+ 
+         return {'card': int(m.group(1)), 'port': int(m.group(2))}
 
     def loss(self, portList, ratePercent):
         """
@@ -539,19 +544,19 @@ class IxiaPacketGenerator(SSHConnection):
             rxPortlist.add(rxPort)
 
         # port init
-        self.config_port([self.interface_to_port(
-            self.tester.get_interface(port)) for port in txPortlist.union(rxPortlist)])
+        self.config_port([self.pci_to_port(
+            self.tester.get_pci(port)) for port in txPortlist.union(rxPortlist)])
 
         # stream/flow setting
         for (txPort, rxPort, pcapFile) in portList:
-            self.config_stream(pcapFile, self.interface_to_port(self.tester.get_interface(txPort)), rate_percent, 1, latency)
+            self.config_stream(pcapFile, self.pci_to_port(self.tester.get_pci(txPort)), rate_percent, 1, latency)
 
         # config stream before packetGroup
         if latency is not False:
             for (txPort, rxPort, pcapFile) in portList:
                 flow_num = len(self.parse_pcap(pcapFile))
-                self.config_pktGroup_rx(self.interface_to_port(self.tester.get_interface(rxPort)))
-                self.config_pktGroup_tx(self.interface_to_port(self.tester.get_interface(txPort)))
+                self.config_pktGroup_rx(self.pci_to_port(self.tester.get_pci(rxPort)))
+                self.config_pktGroup_tx(self.pci_to_port(self.tester.get_pci(txPort)))
         return rxPortlist, txPortlist
 
     def prepare_ixia_for_transmission(self, txPortlist, rxPortlist):
@@ -559,12 +564,12 @@ class IxiaPacketGenerator(SSHConnection):
         Clear all statistics and implement configuration to IXIA hareware.
         """
         self.add_tcl_cmd("ixClearStats portList")
-        self.set_ixia_port_list([self.interface_to_port(self.tester.get_interface(port)) for port in txPortlist])
+        self.set_ixia_port_list([self.pci_to_port(self.tester.get_pci(port)) for port in txPortlist])
         self.add_tcl_cmd("ixWriteConfigToHardware portList")
         for port in txPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
         for port in rxPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
 
     def get_transmission_results(self, rx_port_list, tx_port_list, delay=5):
         """
@@ -574,6 +579,7 @@ class IxiaPacketGenerator(SSHConnection):
         time.sleep(delay)
         bpsRate = 0
         rate = 0
+        oversize = 0
         for port in rx_port_list:
             self.stat_get_rate_stat_all_stats(port)
             out = self.send_expect("stat cget -framesReceived", '%', 10)
@@ -619,7 +625,7 @@ class IxiaPacketGenerator(SSHConnection):
         Get the connect relations between DUT and Ixia.
         """
         for port in dutPorts:
-            info = self.tester.get_interface(self.tester.get_local_port(port)).split('.')
+            info = self.tester.get_pci(self.tester.get_local_port(port)).split('.')
             self.conRelation[port] = [int(info[0]), int(info[1]), repr(self.tester.dut.get_mac_address(port).replace(':', ' ').upper())]
         return self.conRelation
 
@@ -656,7 +662,7 @@ class IxiaPacketGenerator(SSHConnection):
         Stop Packet Group operation on port and get current Packet Group
         statistics on port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         self.send_expect("ixStopPortPacketGroups %d %d %d" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats get %d %d %d 0 16384" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats getGroup 0", "%", 100)
@@ -674,7 +680,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Sends a IXIA TCL command to obtain all the stat values on a given port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat get statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 10)
@@ -683,7 +689,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to prepare the internal buffers were the frames were captured.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'capture get {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -692,7 +698,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         All statistics of specified IXIA port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat getRate statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -702,7 +708,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to load the captured frames into the internal buffers.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'captureBuffer get {0} {1} {2} {3} {4}'
         command = command.format(self.chasId, port['card'], port['port'],
                                  first_frame, last_frame)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 2/5] framework: support configure IXIA port as tester peer port Yong Liu
@ 2015-02-13  2:14   ` Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 4/5] framework: optimize wirespeed calculation and " Yong Liu
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

Implement get pci address funciton in tester module, it will support etgen 
module parse IXIA card number and port id.

Tester should known that whether only kill scapy session or also kill dpdk
application.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/tester.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/framework/tester.py b/framework/tester.py
index 68fec69..bdd039a 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -148,6 +148,12 @@ class Tester(Crb):
         """
         return self.ports_info[self.get_local_port(remotePort)]['type']
 
+    def get_pci(self, localPort):
+        """
+        Return tester local port pci id.
+        """
+        return self.ports_info[localPort]['pci']
+
     def get_interface(self, localPort):
         """
         Return tester local port interface name.
@@ -250,7 +256,7 @@ class Tester(Crb):
         Send ping6 packet from local port with destination ipv6 address.
         """
         if self.ports_info[localPort]['type'] == 'ixia':
-            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['intf'], mac, ipv6)
+            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['pci'], mac, ipv6)
         else:
             return self.send_expect("ping6 -w 5 -c 5 -A -I %s %s" % (self.ports_info[localPort]['intf'], ipv6), "# ", 10)
 
@@ -449,13 +455,13 @@ class Tester(Crb):
             instance.__dict__ = self.ixia_packet_gen.__dict__
             instance.__dict__.update(current_attrs)
 
-    def kill_all(self):
+    def kill_all(self, killall=False):
         """
-        Kill all scapy process and DPDK applications on tester.
+        Kill all scapy process or DPDK application on tester.
         """
         if not self.has_external_traffic_generator():
             self.alt_session.send_expect('killall scapy 2>/dev/null; echo tester', '# ', 5)
-        else:
+        if killall:
             super(Tester, self).kill_all()
 
     def close(self):
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 4/5] framework: optimize wirespeed calculation and kill_all function
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
                     ` (2 preceding siblings ...)
  2015-02-13  2:14   ` [dts] [PATCH V2 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
@ 2015-02-13  2:14   ` Yong Liu
  2015-02-13  2:14   ` [dts] [PATCH V2 5/5] pmd: remove useless nic check function Yong Liu
  2015-02-15  7:05   ` [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform Qiu, Michael
  5 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

When calculate wirespeed of one dut port, we need known both driver and nic 
name. All nic use ixgbe driver, wirespeed is 10G. NIC avoton2c5 wirespeed is 
 2.5G. NIC fortville_eagle wirespeed is 10G. Other Fortville NICs wirespeed 
is 40G.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/crb.py       |  1 -
 framework/test_case.py | 26 ++++++++++++++++++++------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index fa03757..fb3639c 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -284,7 +284,6 @@ class Crb(object):
                 | awk '/config/ {print $2}'` ; do kill -9 $i; done"
         self.alt_session.session.send_expect(cmd, "# ", 10)
         time.sleep(.7)
-        self.check_os_type()
 
     def close(self):
         """
diff --git a/framework/test_case.py b/framework/test_case.py
index c5dd10f..fbde06c 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -33,9 +33,9 @@
 A base class for creating DTF test cases.
 """
 
+import dts
 from exception import VerifyFailure
-from settings import DRIVERS
-
+from settings import DRIVERS, NICS
 
 class TestCase(object):
 
@@ -67,18 +67,32 @@ class TestCase(object):
 
         raise ValueError(nic_name)
 
+    def get_nic_name(self, pci_id):
+        for nic_name, pci in NICS.items():
+            if pci_id == pci:
+                return nic_name
+
+        raise ValueError(nic_name)
+
     def wirespeed(self, nic, frame_size, num_ports):
         """
         Calculate bit rate. It is depended for NICs
         """
         bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
-        if self.get_nic_driver(self.nic) == "ixgbe":
+        if self.nic == "any" or self.nic == "cfg":
+            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
+            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
+        else:
+            driver = self.get_nic_driver(self.nic)
+            nic = self.nic
+
+        if driver == "ixgbe":
             bitrate *= 10  # 10 Gb NICs
-        elif self.nic == "avoton2c5":
+        elif nic == "avoton2c5":
             bitrate *= 2.5  # 2.5 Gb NICs
-        elif self.nic in ["fortville_spirit", "fortville_spirit_single"]:
+        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
             bitrate *= 40
-        elif self.nic == 'fortville_eagle':
+        elif nic == 'fortville_eagle':
            bitrate *= 10
 
         return bitrate * num_ports / 8 / (frame_size + 20)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V2 5/5] pmd: remove useless nic check function
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
                     ` (3 preceding siblings ...)
  2015-02-13  2:14   ` [dts] [PATCH V2 4/5] framework: optimize wirespeed calculation and " Yong Liu
@ 2015-02-13  2:14   ` Yong Liu
  2015-02-15  7:05   ` [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform Qiu, Michael
  5 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-13  2:14 UTC (permalink / raw)
  To: dts

Testpmd suite should not limited itself only run on sepcified NICs.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 tests/TestSuite_pmd.py | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index c5b7e3b..7acf937 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -92,28 +92,11 @@ class TestPmd(TestCase):
             self.table_header.append("%s Mpps" % test_cycle['cores'])
             self.table_header.append("% linerate")
 
-        self.needed_ports = {"niantic": 2,
-                             "kawela_2": 2,
-                             "bartonhills": 4,
-                             "82545EM": 2,
-                             "82540EM": 2,
-                             "I217V": 1,
-                             "I217LM": 1,
-                             "I218V": 1,
-                             "I218LM": 1}
-
         self.blacklist = ""
 
-        self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", "82540EM", "I217V", "I217LM", "I218V", "I218LM"],
-                    "NIC Unsupported: " + str(self.nic))
-
         # Based on h/w type, choose how many ports to use
         self.dut_ports = self.dut.get_ports()
 
-        # Verify that enough ports are available
-        self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
-                    "Insufficient ports for speed testing")
-
         self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[
             'ip'] + HEADER_SIZE['udp']
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
                     ` (4 preceding siblings ...)
  2015-02-13  2:14   ` [dts] [PATCH V2 5/5] pmd: remove useless nic check function Yong Liu
@ 2015-02-15  7:05   ` Qiu, Michael
  5 siblings, 0 replies; 21+ messages in thread
From: Qiu, Michael @ 2015-02-15  7:05 UTC (permalink / raw)
  To: Liu, Yong, dts

On 2/13/2015 10:15 AM, Yong Liu wrote:
> This patch support configure IXIA port as tester peer port. Thus will allow 
> us to run IXIA performance test on one platform.
> Removed useless multiple nic types, DTS will support different types nics by 
> port configuration.
>
> Yong Liu (5):
>   framework: remove useless nic list, replaced by port configuration
>     file
>   framework: support configure IXIA port as tester peer port
>   framework: seperate killl scapy and kill DPDK application in kill_all
>     function
>   framework: optimize wirespeed calculation and kill_all function
>   pmd: remove useless nic check function
>
>  conf/ports.cfg         |  6 ++++--
>  framework/crb.py       |  1 -
>  framework/dts.py       | 30 ++++++++++++++---------------
>  framework/dut.py       | 41 +++++++++++++++++----------------------
>  framework/etgen.py     | 52 ++++++++++++++++++++++++++++----------------------
>  framework/test_case.py | 26 +++++++++++++++++++------
>  framework/tester.py    | 14 ++++++++++----
>  tests/TestSuite_pmd.py | 17 -----------------
>  8 files changed, 95 insertions(+), 92 deletions(-)
>
Acked-by: Michael Qiu <michael.qiu@intel.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 0/5] Support IXIA performance validation on one platform
  2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
                   ` (6 preceding siblings ...)
  2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
@ 2015-02-16  3:07 ` Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
                     ` (4 more replies)
  7 siblings, 5 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

This patch support configure IXIA port as tester peer port. Thus will allow 
us to run IXIA performance test on one platform.
Removed useless multiple nic types, DTS will support different types nics by 
port configuration.

V3: support auto-detect port type when dut/tester on same platform.
V2: add detail comments in log.

Yong Liu (5):
  framework: remove useless nic list, replaced by port configuration
    file
  framework: support configure IXIA port as tester peer port
  framework: seperate kill scapy and DPDK application in kill_all
    function
  framework: optimize wirespeed calculation and kill_all function
  pmd: remove useless nic check function

 conf/ports.cfg         |   6 ++-
 framework/crb.py       |   1 -
 framework/dts.py       |  24 +++++------
 framework/dut.py       | 107 +++++++++++++++++++++++++++----------------------
 framework/etgen.py     |  48 ++++++++++++----------
 framework/test_case.py |  25 +++++++++---
 framework/tester.py    |  24 +++++++++--
 tests/TestSuite_pmd.py |  17 --------
 8 files changed, 142 insertions(+), 110 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
@ 2015-02-16  3:07   ` Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 2/5] framework: support configure IXIA port as tester peer port Yong Liu
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

DTS used to support different types of nic by parameter nic_type. But in the
process of running, DTS only take first four ports for validation. This may
be cause confusion.

Removed these logic for multi nic will be supported by port configuration
file. In execution.cfg will only parse the first nic_type now.

Fix bug that port act as tester should not be in dut port list.

Signed-off-by: Marvinliu <yong.liu@intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index f05024f..1c7a43e 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -64,7 +64,7 @@ results_table_rows = []
 results_table_header = []
 performance_only = False
 functional_only = False
-nics = None
+nic = None
 requested_tests = None
 dut = None
 tester = None
@@ -151,13 +151,12 @@ def accepted_nic(pci_id):
     if pci_id not in NICS.values():
         return False
 
-    if 'any' in nics:
+    if nic is 'any':
         return True
 
     else:
-        for selected_nic in nics:
-            if pci_id == NICS[selected_nic]:
-                return True
+        if pci_id == NICS[nic]:
+            return True
 
     return False
 
@@ -211,9 +210,9 @@ def dts_parse_config(section):
         if suite == '':
             test_suites.remove(suite)
 
-    nics = [_.strip() for _ in paramDict['nic_type'].split(',')]
+    nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0]
 
-    return duts[0], targets, test_suites, nics
+    return duts[0], targets, test_suites, nic
 
 
 def get_project_obj(project_name, super_class, crbInst, serializer):
@@ -267,7 +266,7 @@ def dts_log_execution(log_handler):
         pass
 
 
-def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
+def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic):
     """
     Create dts dut/tester instance and initialize them.
     """
@@ -282,7 +281,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
     tester.dut = dut
     dut.set_speedup_options(read_cache, skip_setup)
     dut.set_directory(base_dir)
-    dut.set_nic_types(nics)
+    dut.set_nic_type(nic)
     tester.set_speedup_options(read_cache, skip_setup)
     show_speedup_options_messages(read_cache, skip_setup)
     dut.set_test_types(func_tests=functional_only, perf_tests=performance_only)
@@ -315,7 +314,7 @@ def dts_run_prerequisties(pkgName, patch):
         return False
 
 
-def dts_run_target(crbInst, targets, test_suites, nics):
+def dts_run_target(crbInst, targets, test_suites, nic):
     """
     Run each target in execution targets.
     """
@@ -336,8 +335,7 @@ def dts_run_target(crbInst, targets, test_suites, nics):
 
         if 'nic_type' not in paramDict:
             paramDict['nic_type'] = 'any'
-            nics = ['any']
-        nic = nics[0]
+            nic = 'any'
         result.nic = nic
 
         dts_run_suite(crbInst, test_suites, target, nic)
@@ -394,7 +392,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
     global config
     global serializer
-    global nics
+    global nic
     global requested_tests
     global result
     global excel_report
diff --git a/framework/dut.py b/framework/dut.py
index 267e7f1..e11414f 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -82,12 +82,12 @@ class Dut(Crb):
         self.send_expect("sed -i 's/%s=.*$/%s=%s/'  config/defconfig_%s" %
                          (parameter, parameter, value, target), "# ")
 
-    def set_nic_types(self, nics):
+    def set_nic_type(self, nic):
         """
         Set CRB NICS ready to validated.
         """
-        self.nics = nics
-        if 'cfg' in nics:
+        self.nic = nic
+        if 'cfg' in nic:
             self.conf.load_ports_config(self.get_ip_address())
 
     def set_toolchain(self, target):
@@ -167,6 +167,8 @@ class Dut(Crb):
         self.mount_procfs()
         # auto detect network topology
         self.map_available_ports()
+        # print latest ports_info
+        self.logger.info(dts.pprint(self.ports_info))
         if self.ports_map is None or len(self.ports_map) == 0:
             raise ValueError("ports_map should not be empty, please check all links")
 
@@ -305,7 +307,6 @@ class Dut(Crb):
         Return DUT port list with the filter of NIC type, whether run IXIA
         performance test, whether request specified socket.
         """
-
         ports = []
         candidates = []
 
@@ -313,33 +314,28 @@ class Dut(Crb):
             perf = self.want_perf_tests
 
         nictypes = []
-        if nic_type == 'any' and perf:
+        if nic_type == 'any':
+            for portid in range(len(self.ports_info)):
+                ports.append(portid)
             return ports
-
-        for nic in NICS.keys():
-            if ('any' == nic_type) or (nic_type in nic):
-                nictypes.append(nic)
-
-        for portid in range(len(self.ports_info)):
-            for nictype in nictypes:
-
-                if self.ports_info[portid]['type'] == NICS[nictype]:
+        elif nic_type == 'cfg':
+            for portid in range(len(self.ports_info)):
+                if self.ports_info[portid]['source'] == 'cfg':
+                    ports.append(portid)
+            return ports
+        else:
+            for portid in range(len(self.ports_info)):
+                port_info = self.ports_info[portid]
+                # match nic type
+                if port_info['type'] == NICS[nic_type]:
+                    # match numa or none numa awareness
                     if (socket is None or
-                        self.ports_info[portid]['numa'] == -1 or
-                            socket == self.ports_info[portid]['numa']):
-
-                        if (self.ports_info[portid]['ipv6'] != "Not connected" and
+                        port_info['numa'] == -1 or
+                            socket == port_info['numa']):
+                        # port has link
+                        if (port_info['ipv6'] != "Not connected" and
                                 self.tester.get_local_port(portid) != -1):
-                            if perf and self.tester.get_local_port_type(portid) != "ixia":
-                                candidates.append(portid)
-                                continue
-                            elif False == perf and self.tester.get_local_port_type(portid) == "ixia":
-                                continue
                             ports.append(portid)
-
-        if perf and not self.tester.has_external_traffic_generator():
-            return candidates
-        else:
             return ports
 
     def get_ports_performance(self, nic_type='any', perf=None, socket=None,
@@ -410,6 +406,14 @@ class Dut(Crb):
 
         return self.ports_info[port_num]['numa']
 
+    def get_port_info(self, pci):
+        """
+        return port info by pci id
+        """
+        for port_info in self.ports_info:
+            if port_info['pci'] == pci:
+                return port_info
+
     def lcore_table_print(self, horizontal=False):
         if not horizontal:
             dts.results_table_add_header(['Socket', 'Core', 'Thread'])
@@ -436,20 +440,17 @@ class Dut(Crb):
         Check that whether auto scanned ports ready to use
         """
         pci_addr = "%s:%s" % (pci_bus, pci_id)
-        codenames = []
-        for nic in self.nics:
-            if nic == 'any':
-                return True
-            elif nic == 'cfg':
-                if self.conf.check_port_available(pci_bus) is True:
-                    return True
-            elif nic not in NICS.keys():
-                self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)
-            else:
-                codenames.append(NICS[nic])
-
-        if pci_id in codenames:
+        if self.nic == 'any':
             return True
+        elif self.nic == 'cfg':
+            if self.conf.check_port_available(pci_bus) is True:
+                return True
+        elif self.nic not in NICS.keys():
+            self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic)
+        else:
+            codename = NICS[self.nic]
+            if pci_id == codename:
+                return True
 
         return False
 
@@ -491,8 +492,6 @@ class Dut(Crb):
             self.scan_ports_uncached()
             self.serializer.save(self.PORT_INFO_CACHE_KEY, self.ports_info)
 
-        self.logger.info(dts.pprint(self.ports_info))
-
     def scan_ports_uncached(self):
         """
         Scan ports and collect port's pci id, mac adress, ipv6 address.
@@ -578,10 +577,10 @@ class Dut(Crb):
             else:
                 port_cfg = {}
 
-            for key in ['intf', 'mac', 'numa', 'peer']:
+            for key in ['intf', 'mac', 'numa', 'peer', 'source']:
                 if key in port_cfg:
                     if key in port and port_cfg[key] != port[key]:
-                        self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
+                        self.logger.warning("CONFIGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
                     port[key] = port_cfg[key]
 
     def map_available_ports(self):
@@ -594,17 +593,18 @@ class Dut(Crb):
         if not self.read_cache or self.ports_map is None:
             self.map_available_ports_uncached()
             self.serializer.save(self.PORT_MAP_CACHE_KEY, self.ports_map)
-            self.logger.warning("DUT PORT MAP: " + str(self.ports_map))
+
+        self.logger.warning("DUT PORT MAP: " + str(self.ports_map))
 
     def map_available_ports_uncached(self):
         """
         Generate network connection mapping list.
         """
-
         nrPorts = len(self.ports_info)
         if nrPorts == 0:
             return
 
+        remove = []
         self.ports_map = [-1] * nrPorts
 
         hits = [False] * len(self.tester.ports_info)
@@ -632,6 +632,7 @@ class Dut(Crb):
                 if (self.crb['IP'] == self.crb['tester IP']) and (dutpci == remotepci):
                     continue
 
+                # skip ping those not connected port
                 ipv6 = self.get_ipv6_address(dutPort)
                 if ipv6 == "Not connected":
                     continue
@@ -640,6 +641,18 @@ class Dut(Crb):
 
                 if ('64 bytes from' in out):
                     self.logger.info("PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort))
-                    hits[remotePort] = True
                     self.ports_map[dutPort] = remotePort
+                    hits[remotePort] = True
+                    if self.crb['IP'] == self.crb['tester IP']:
+                        # remove dut port act as tester port
+                        remove_port = self.get_port_info(remotepci)
+                        if remove_port is not None:
+                            remove.append(remove_port)
+                        # skip ping from those port already act as dut port
+                        testerPort = self.tester.get_local_index(dutpci)
+                        if testerPort != -1:
+                            hits[testerPort] = True
                     break
+
+        for port in remove:
+            self.ports_info.remove(port)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 2/5] framework: support configure IXIA port as tester peer port
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
@ 2015-02-16  3:07   ` Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 3/5] framework: seperate kill scapy and DPDK application in kill_all function Yong Liu
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

Now we can specify DUT's IXIA port id in port configuration file. Now can run
performance validation with only one DUT.

Signed-off-by: Marvinliu <yong.liu@intel.com>

diff --git a/conf/ports.cfg b/conf/ports.cfg
index eb2cb34..43cab27 100644
--- a/conf/ports.cfg
+++ b/conf/ports.cfg
@@ -3,7 +3,9 @@
 # ports=
 #     pci=Pci BDF,intf=Kernel interface;
 #     pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa 
+#     pci=Pci BDF,peer=IXIA:card.port
 [DUT IP]
-ports = 
+ports =
     pci=XX:XX.X,intf=eth0;
-    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
+    pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0;
+    pci=ZZ:ZZ.Y,peer=IXIA:X.Y
diff --git a/framework/etgen.py b/framework/etgen.py
index f2da4ab..16df3f9 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -112,7 +112,7 @@ class SoftwarePacketGenerator():
 
         self.tester.send_expect("stop all", "Pktgen>")
         self.tester.send_expect("quit", "# ")
-        self.tester.kill_all()
+        self.tester.kill_all(killall=True)
         self.tester.restore_interfaces()
 
         return rx_bps, tx_bps, rx_pps
@@ -385,13 +385,13 @@ class IxiaPacketGenerator(SSHConnection):
                          string.join(['[list %d %d %d]' %
                                       (self.chasId, item['card'], item['port']) for item in pList], ' '))
 
-    def send_ping6(self, intf, mac, ipv6):
+    def send_ping6(self, pci, mac, ipv6):
         """
         Send ping6 packet from IXIA ports.
         """
         self.send_expect("source ./ixTcl1.0/ixiaPing6.tcl", "% ")
         out = self.send_expect('ping6 "%s" "%s" %d %d %d' %
-                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.interface_to_port(intf)['card'], self.interface_to_port(intf)['port']), "% ", 90)
+                               (self.ipv6_to_tcl_format(ipv6), self.macToTclFormat(mac), self.chasId, self.pci_to_port(pci)['card'], self.pci_to_port(pci)['port']), "% ", 90)
         return out
 
     def ipv6_to_tcl_format(self, ipv6):
@@ -424,14 +424,19 @@ class IxiaPacketGenerator(SSHConnection):
             return plist
 
         for p in self.ports:
-            plist.append({'type': 'ixia', 'intf': '%d.%d' % (p['card'], p['port'])})
+            plist.append({'type': 'ixia', 'pci': 'IXIA:%d.%d' % (p['card'], p['port'])})
         return plist
 
-    def interface_to_port(self, intf):
+    def pci_to_port(self, pci):
         """
-        Convert IXIA interface to IXIA port.
+        Convert IXIA fake pci to IXIA port.
         """
-        return {'card': int(intf.split('.')[0]), 'port': int(intf.split('.')[1])}
+        ixia_pci_regex = "IXIA:(\d).(\d)"
+        m = re.match(ixia_pci_regex, pci)
+        if m is None:
+            return {'card': -1, 'port': -1}
+
+        return {'card': int(m.group(1)), 'port': int(m.group(2))}
 
     def loss(self, portList, ratePercent):
         """
@@ -539,19 +544,19 @@ class IxiaPacketGenerator(SSHConnection):
             rxPortlist.add(rxPort)
 
         # port init
-        self.config_port([self.interface_to_port(
-            self.tester.get_interface(port)) for port in txPortlist.union(rxPortlist)])
+        self.config_port([self.pci_to_port(
+            self.tester.get_pci(port)) for port in txPortlist.union(rxPortlist)])
 
         # stream/flow setting
         for (txPort, rxPort, pcapFile) in portList:
-            self.config_stream(pcapFile, self.interface_to_port(self.tester.get_interface(txPort)), rate_percent, 1, latency)
+            self.config_stream(pcapFile, self.pci_to_port(self.tester.get_pci(txPort)), rate_percent, 1, latency)
 
         # config stream before packetGroup
         if latency is not False:
             for (txPort, rxPort, pcapFile) in portList:
                 flow_num = len(self.parse_pcap(pcapFile))
-                self.config_pktGroup_rx(self.interface_to_port(self.tester.get_interface(rxPort)))
-                self.config_pktGroup_tx(self.interface_to_port(self.tester.get_interface(txPort)))
+                self.config_pktGroup_rx(self.pci_to_port(self.tester.get_pci(rxPort)))
+                self.config_pktGroup_tx(self.pci_to_port(self.tester.get_pci(txPort)))
         return rxPortlist, txPortlist
 
     def prepare_ixia_for_transmission(self, txPortlist, rxPortlist):
@@ -559,12 +564,12 @@ class IxiaPacketGenerator(SSHConnection):
         Clear all statistics and implement configuration to IXIA hareware.
         """
         self.add_tcl_cmd("ixClearStats portList")
-        self.set_ixia_port_list([self.interface_to_port(self.tester.get_interface(port)) for port in txPortlist])
+        self.set_ixia_port_list([self.pci_to_port(self.tester.get_pci(port)) for port in txPortlist])
         self.add_tcl_cmd("ixWriteConfigToHardware portList")
         for port in txPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
         for port in rxPortlist:
-            self.start_pktGroup(self.interface_to_port(self.tester.get_interface(port)))
+            self.start_pktGroup(self.pci_to_port(self.tester.get_pci(port)))
 
     def get_transmission_results(self, rx_port_list, tx_port_list, delay=5):
         """
@@ -574,6 +579,7 @@ class IxiaPacketGenerator(SSHConnection):
         time.sleep(delay)
         bpsRate = 0
         rate = 0
+        oversize = 0
         for port in rx_port_list:
             self.stat_get_rate_stat_all_stats(port)
             out = self.send_expect("stat cget -framesReceived", '%', 10)
@@ -619,7 +625,7 @@ class IxiaPacketGenerator(SSHConnection):
         Get the connect relations between DUT and Ixia.
         """
         for port in dutPorts:
-            info = self.tester.get_interface(self.tester.get_local_port(port)).split('.')
+            info = self.tester.get_pci(self.tester.get_local_port(port)).split('.')
             self.conRelation[port] = [int(info[0]), int(info[1]), repr(self.tester.dut.get_mac_address(port).replace(':', ' ').upper())]
         return self.conRelation
 
@@ -656,7 +662,7 @@ class IxiaPacketGenerator(SSHConnection):
         Stop Packet Group operation on port and get current Packet Group
         statistics on port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         self.send_expect("ixStopPortPacketGroups %d %d %d" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats get %d %d %d 0 16384" % (self.chasId, port['card'], port['port']), "%", 100)
         self.send_expect("packetGroupStats getGroup 0", "%", 100)
@@ -674,7 +680,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Sends a IXIA TCL command to obtain all the stat values on a given port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat get statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 10)
@@ -683,7 +689,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to prepare the internal buffers were the frames were captured.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'capture get {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -692,7 +698,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         All statistics of specified IXIA port.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'stat getRate statAllStats {0} {1} {2}'
         command = command.format(self.chasId, port['card'], port['port'])
         self.send_expect(command, '% ', 30)
@@ -702,7 +708,7 @@ class IxiaPacketGenerator(SSHConnection):
         """
         Tells IXIA to load the captured frames into the internal buffers.
         """
-        port = self.interface_to_port(self.tester.get_interface(port_number))
+        port = self.pci_to_port(self.tester.get_pci(port_number))
         command = 'captureBuffer get {0} {1} {2} {3} {4}'
         command = command.format(self.chasId, port['card'], port['port'],
                                  first_frame, last_frame)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 3/5] framework: seperate kill scapy and DPDK application in kill_all function
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 2/5] framework: support configure IXIA port as tester peer port Yong Liu
@ 2015-02-16  3:07   ` Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and " Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 5/5] pmd: remove useless nic check function Yong Liu
  4 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

Implement get pci address funciton in tester module, it will support etgen
module parse IXIA card number and port id.

Implement get tester port index function in tester module, it will support
detect dut/tester port type automatically.

Tester should known that whether only kill scapy session or also kill dpdk
application.

Signed-off-by: Marvinliu <yong.liu@intel.com>

diff --git a/framework/tester.py b/framework/tester.py
index 2834d77..2debcd6 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -143,6 +143,22 @@ class Tester(Crb):
         """
         return self.ports_info[self.get_local_port(remotePort)]['type']
 
+    def get_local_index(self, pci):
+        """
+        Return tester local port index by pci id
+        """
+        index = -1
+        for port in self.ports_info:
+            index += 1
+            if pci == port['pci']:
+                return index
+
+    def get_pci(self, localPort):
+        """
+        Return tester local port pci id.
+        """
+        return self.ports_info[localPort]['pci']
+
     def get_interface(self, localPort):
         """
         Return tester local port interface name.
@@ -245,7 +261,7 @@ class Tester(Crb):
         Send ping6 packet from local port with destination ipv6 address.
         """
         if self.ports_info[localPort]['type'] == 'ixia':
-            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['intf'], mac, ipv6)
+            return self.ixia_packet_gen.send_ping6(self.ports_info[localPort]['pci'], mac, ipv6)
         else:
             return self.send_expect("ping6 -w 5 -c 5 -A -I %s %s" % (self.ports_info[localPort]['intf'], ipv6), "# ", 10)
 
@@ -384,13 +400,13 @@ class Tester(Crb):
             instance.__dict__ = self.ixia_packet_gen.__dict__
             instance.__dict__.update(current_attrs)
 
-    def kill_all(self):
+    def kill_all(self, killall=False):
         """
-        Kill all scapy process and DPDK applications on tester.
+        Kill all scapy process or DPDK application on tester.
         """
         if not self.has_external_traffic_generator():
             self.alt_session.send_expect('killall scapy 2>/dev/null; echo tester', '# ', 5)
-        else:
+        if killall:
             super(Tester, self).kill_all()
 
     def close(self):
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and kill_all function
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
                     ` (2 preceding siblings ...)
  2015-02-16  3:07   ` [dts] [PATCH V3 3/5] framework: seperate kill scapy and DPDK application in kill_all function Yong Liu
@ 2015-02-16  3:07   ` Yong Liu
  2015-02-16  3:07   ` [dts] [PATCH V3 5/5] pmd: remove useless nic check function Yong Liu
  4 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

When calculate wirespeed of one dut port, we need known both driver and nic
name. All nic use ixgbe driver, wirespeed is 10G. NIC avoton2c5 wirespeed is
 2.5G. NIC fortville_eagle wirespeed is 10G. Other Fortville NICs wirespeed
is 40G.

Signed-off-by: Marvinliu <yong.liu@intel.com>

diff --git a/framework/crb.py b/framework/crb.py
index 317be15..28df2f9 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -286,7 +286,6 @@ class Crb(object):
                 | awk '/config/ {print $2}'` ; do kill -9 $i; done"
         self.alt_session.session.send_expect(cmd, "# ", 10)
         time.sleep(.7)
-        self.check_os_type()
 
     def close(self):
         """
diff --git a/framework/test_case.py b/framework/test_case.py
index 66f7262..b1595fb 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -33,8 +33,9 @@
 A base class for creating DTF test cases.
 """
 
+import dts
 from exception import VerifyFailure
-from settings import DRIVERS
+from settings import DRIVERS, NICS
 
 
 class TestCase(object):
@@ -67,18 +68,32 @@ class TestCase(object):
 
         raise ValueError(nic_name)
 
+    def get_nic_name(self, pci_id):
+        for nic_name, pci in NICS.items():
+            if pci_id == pci:
+                return nic_name
+
+        raise ValueError(nic_name)
+
     def wirespeed(self, nic, frame_size, num_ports):
         """
         Calculate bit rate. It is depended for NICs
         """
         bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
-        if self.get_nic_driver(self.nic) == "ixgbe":
+        if self.nic == "any" or self.nic == "cfg":
+            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
+            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
+        else:
+            driver = self.get_nic_driver(self.nic)
+            nic = self.nic
+
+        if driver == "ixgbe":
             bitrate *= 10  # 10 Gb NICs
-        elif self.nic == "avoton2c5":
+        elif nic == "avoton2c5":
             bitrate *= 2.5  # 2.5 Gb NICs
-        elif self.nic in ["fortville_spirit", "fortville_spirit_single"]:
+        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
             bitrate *= 40
-        elif self.nic == 'fortville_eagle':
+        elif nic == 'fortville_eagle':
             bitrate *= 10
 
         return bitrate * num_ports / 8 / (frame_size + 20)
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dts] [PATCH V3 5/5] pmd: remove useless nic check function
  2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
                     ` (3 preceding siblings ...)
  2015-02-16  3:07   ` [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and " Yong Liu
@ 2015-02-16  3:07   ` Yong Liu
  4 siblings, 0 replies; 21+ messages in thread
From: Yong Liu @ 2015-02-16  3:07 UTC (permalink / raw)
  To: dts

Testpmd suite should not limited itself only run on sepcified NICs.

Signed-off-by: Marvinliu <yong.liu@intel.com>

diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index c5b7e3b..7acf937 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -92,28 +92,11 @@ class TestPmd(TestCase):
             self.table_header.append("%s Mpps" % test_cycle['cores'])
             self.table_header.append("% linerate")
 
-        self.needed_ports = {"niantic": 2,
-                             "kawela_2": 2,
-                             "bartonhills": 4,
-                             "82545EM": 2,
-                             "82540EM": 2,
-                             "I217V": 1,
-                             "I217LM": 1,
-                             "I218V": 1,
-                             "I218LM": 1}
-
         self.blacklist = ""
 
-        self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", "82540EM", "I217V", "I217LM", "I218V", "I218LM"],
-                    "NIC Unsupported: " + str(self.nic))
-
         # Based on h/w type, choose how many ports to use
         self.dut_ports = self.dut.get_ports()
 
-        # Verify that enough ports are available
-        self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
-                    "Insufficient ports for speed testing")
-
         self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[
             'ip'] + HEADER_SIZE['udp']
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-02-16  3:08 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 4/5] framework: optimize wirespeed calculation and " Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 5/5] pmd: remove useless nic check function Yong Liu
2015-02-12  9:08 ` [dts] [PATCH 0/5] Support IXIA performance validation on one platform Qiu, Michael
2015-02-13  0:44   ` Liu, Yong
2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 4/5] framework: optimize wirespeed calculation and " Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 5/5] pmd: remove useless nic check function Yong Liu
2015-02-15  7:05   ` [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform Qiu, Michael
2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 3/5] framework: seperate kill scapy and DPDK application in kill_all function Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and " Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 5/5] pmd: remove useless nic check function Yong Liu

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).