From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 021CA4CC5 for ; Thu, 28 Feb 2019 11:59:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 02:59:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,423,1544515200"; d="scan'208";a="324137029" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 28 Feb 2019 02:59:03 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 02:59:03 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 02:59:02 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.158]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.252]) with mapi id 14.03.0415.000; Thu, 28 Feb 2019 18:59:01 +0800 From: "Tu, Lijuan" To: "Mo, YufengX" , "dts@dpdk.org" CC: "Mo, YufengX" Thread-Topic: [dts] [PATCH V2]pmd_bonded_8023ad: upload automation script Thread-Index: AQHUzycoCQ5bG/pJa06LNXHTxbyrNqX1CuGQ Date: Thu, 28 Feb 2019 10:58:59 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA37BA0@SHSMSX101.ccr.corp.intel.com> References: <1551332164-33086-1-git-send-email-yufengx.mo@intel.com> <1551332164-33086-2-git-send-email-yufengx.mo@intel.com> In-Reply-To: <1551332164-33086-2-git-send-email-yufengx.mo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWQ5MmY5NjEtZDU2MC00YTAxLTljMzUtMzM0ZmU0YTI5ZjAxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiK3lxY0JUWnFrXC92bHdZQzU1aHNyWDc0Y1ZIWWx4QUpPQitxXC82cEkwOGNIVnA3VXBsU1orcWhrMU53RWFSZHhZIn0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2]pmd_bonded_8023ad: upload automation script X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 10:59:05 -0000 Applying: pmd_bonded_8023ad: upload automation script .git/rebase-apply/patch:69: trailing whitespace. .git/rebase-apply/patch:94: trailing whitespace. cmds =3D[ .git/rebase-apply/patch:180: trailing whitespace. .git/rebase-apply/patch:419: trailing whitespace. self.bond_inst.get_bonding_info(bond_port, .git/rebase-apply/patch:466: trailing whitespace. if not cur_active_slaves or cmp(sorted(slaves), warning: 5 lines add whitespace errors. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx > Sent: Thursday, February 28, 2019 1:36 PM > To: dts@dpdk.org > Cc: Mo, YufengX > Subject: [dts] [PATCH V2]pmd_bonded_8023ad: upload automation script >=20 >=20 > This automation script is for pmd bonded 8023ad feature. >=20 > IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that s= hare > the same speed and duplex settings. Utilizes all slaves in the active ag= gregator > according to the 802.3ad specification. Slave selection for outgoing traf= fic is > done according to the transmit hash policy. >=20 > Signed-off-by: yufengmx > --- > tests/TestSuite_pmd_bonded_8023ad.py | 599 > +++++++++++++++++++++++++++++++++++ > 1 file changed, 599 insertions(+) > create mode 100644 tests/TestSuite_pmd_bonded_8023ad.py >=20 > diff --git a/tests/TestSuite_pmd_bonded_8023ad.py > b/tests/TestSuite_pmd_bonded_8023ad.py > new file mode 100644 > index 0000000..cad573e > --- /dev/null > +++ b/tests/TestSuite_pmd_bonded_8023ad.py > @@ -0,0 +1,599 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > # > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY # > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE # > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +import time > +import re > +import traceback > + > +# import dts/framework libs > +from test_case import TestCase > +from exception import VerifyFailure > + > +# import bonding lib(common methods for pmd bonding command) import > +bonding from bonding import MODE_LACP, FRAME_SIZE_64 > + > +###################### > +# bonding 802.3ad mode > +###################### > +class TestBonding8023AD(TestCase): > + AGG_MODES =3D ["bandwidth", "stable", "count"] > + DEDICATED_QUEUES =3D ['disable', 'enable'] > + > + # > + # On dut, dpdk bonding > + # > + > + def set_8023ad_agg_mode(self, bond_port, mode=3D"bandwidth"): > + """ > + set bonding agg_mode > + > + Set 802.11AD Aggregator Mode > + """ > + cmd =3D "set bonding agg_mode %d %s" % (bond_port, mode) > + self.bond_inst.d_console(cmd) > + cur_mode =3D self.bond_inst.get_bonding_info(bond_port, 'agg_mod= e') > + if mode =3D=3D cur_mode: > + fmt =3D "set bonding agg_mode <{0}> successfully" > + self.logger.info(fmt.format(mode)) > + else: > + msg =3D "failed to set bonding agg_mode <{0}>".format(mode) > + self.logger.error(msg) > + raise VerifyFailure(msg) > + > + def get_8023ad_agg_mode(self, bond_port): > + """ > + get 802.3ad mode aggregator Mode > + """ > + cur_mode =3D self.bond_inst.get_bonding_info(bond_port, 'agg_mod= e') > + return cur_mode > + > + def set_8023ad_dedicated_queues(self, bond_port, status=3D'disable')= : > + """ > + set 802.11AD dedicated_queues mode(enable|disable) > + """ > + cmds =3D[ > + ["set bonding lacp dedicated_queues %s %s" % (bond_port, sta= tus), > + ['', 'port %s failed'%bond_port, False], 2],] > + out =3D self.bond_inst.d_console(cmds) > + # when set 'hw' > + if status =3D=3D 'enable': > + expected_msg =3D 'queues for LACP control packets enabled' > + err_fmt =3D "link bonding mode 4 (802.3ad) set {0} failed" > + self.verify(expected_msg in out, err_fmt.format(status)) > + elif status =3D=3D 'disable': > + expected_msg =3D 'queues for LACP control packets disabled' > + err_fmt =3D "link bonding mode 4 (802.3ad) set {0} failed" > + self.verify(expected_msg in out, err_fmt.format(status)) > + > + def set_8023ad_bonded(self, slaves, bond_mode, ignore=3DTrue): > + ''' set 802.3ad bonded mode for the specified bonding mode ''' > + specified_socket =3D self.dut.get_numa_id(slaves[0]) > + # create bonded device, add slaves in it > + bond_port =3D self.bond_inst.create_bonded_device(bond_mode, > specified_socket) > + if not ignore: > + # when no slave attached, mac should be 00:00:00:00:00:00 > + self.bonding_8023ad_check_macs_without_slaves(bond_port) > + # add slave > + self.bond_inst.add_slave(bond_port, False, '', *slaves) > + return bond_port > + > + def get_pci_link(self, slaves): > + ''' get slaves ports pci address ''' > + slaves_pci =3D [] > + for port_id in slaves: > + slaves_pci.append(self.dut.ports_info[port_id]['pci']) > + if not slaves_pci: > + msg =3D "can't find tx_port pci" > + self.logger.error(msg) > + raise VerifyFailure(msg) > + return slaves_pci > + > + def set_bond_port_ready(self, tx_port, bond_port): > + cmd=3D "set portlist {0},{1}".format(tx_port, bond_port) > + self.bond_inst.d_console(cmd) > + # for port link up is slow and unstable, > + # every port should start one by one > + cmds =3D [] > + port_num =3D len(self.dut_ports) > + start_fmt =3D "port start {0}".format > + for cnt in range(port_num): > + cmds.append([start_fmt(cnt), '', 5]) > + self.bond_inst.d_console(cmds) > + time.sleep(10) > + self.bond_inst.d_console([start_fmt(self.bond_port), '', 15]) > + time.sleep(5) > + self.bond_inst.d_console(["start", '', 10]) > + self.logger.info("set bond port ready done !!!") > + > + def run_8023ad_pre(self, slaves, bond_mode): > + bond_port =3D self.set_8023ad_bonded(slaves, bond_mode) > + # should set port to stop and make sure port re-sync with parter= when > + # testpmd linking with switch equipment > + cmds =3D ["port stop all", '', 15] > + self.bond_inst.d_console(cmds) > + time.sleep(2) > + cmds =3D ["port start all", '', 10] > + self.bond_inst.d_console(cmds) > + time.sleep(2) > + return bond_port > + > + def bonding_8023ad_check_macs_without_slaves(self, bond_port): > + query_type =3D 'mac' > + bond_port_mac =3D self.bond_inst.get_port_mac(bond_port, query_t= ype) > + default_mac =3D '00:00:00:00:00:00' > + if bond_port_mac =3D=3D default_mac: > + msg =3D "bond port default mac is [{0}]".format(default_mac) > + self.logger.info(msg) > + else: > + fmt =3D "bond port default mac is [{0}], not expected mac" > + msg =3D fmt.format(bond_port_mac) > + self.logger.warning(msg) > + > + def bonding_8023ad_check_macs(self, slaves, bond_port): > + ''' check if bonded device's mac is one of its slaves mac ''' > + query_type =3D 'mac' > + bond_port_mac =3D self.bond_inst.get_port_mac(bond_port, query_t= ype) > + if bond_port_mac =3D=3D '00:00:00:00:00:00': > + msg =3D "bond port hasn't set mac address" > + self.logger.info(msg) > + return > + > + for port_id in slaves: > + slave_mac =3D self.bond_inst.get_port_info(port_id, query_ty= pe) > + if bond_port_mac =3D=3D slave_mac: > + fmt =3D "bonded device's mac is slave [{0}]'s mac [{1}]" > + msg =3D fmt.format(port_id, slave_mac) > + self.logger.info(msg) > + return port_id > + else: > + fmt =3D "bonded device's current mac [{0}] " + \ > + "is not one of its slaves mac" > + msg =3D fmt.format(bond_port_mac) > + # it is not supported by dpdk, but supported by linux normal > + # bonding/802.3ad tool > + self.logger.warning('bonding_8023ad_check_macs: ' + msg) > + > + def check_bonded_device_mac_change(self, slaves, bond_port): > + remove_slave =3D 0 > + cur_slaves =3D slaves[1:] > + self.bond_inst.remove_slaves(bond_port, False, *[remove_slave]) > + self.bonding_8023ad_check_macs(cur_slaves, bond_port) > + > + def check_bonded_device_start(self, bond_port): > + cmds =3D [["port stop all", '', 15], > + ["port start %s"%bond_port, '', 10], > + ["start", [' ', 'core dump', False]]] > + self.bond_inst.d_console(cmds) > + time.sleep(2) > + > + def stop_bonded_device(self, bond_port): > + cmds =3D[["stop", '', 10], > + ["port stop %s"%bond_port, '', 10],] > + self.bond_inst.d_console(cmds) > + time.sleep(2) > + > + def check_bonded_device_up_down(self, bond_port): > + # stop bonded device > + cmd =3D "port stop {0}".format(bond_port) > + self.bond_inst.d_console(cmd) > + status =3D self.bond_inst.get_port_info(bond_port, 'link_status'= ) > + if status !=3D 'down': > + msg =3D "bond port {0} fail to set down".format(bond_port) > + self.logger.error(msg) > + raise VerifyFailure(msg) > + else: > + msg =3D "bond port {0} set down successful !".format(bond_po= rt) > + self.logger.info(msg) > + # start bonded device > + cmds =3D ["port start {0}".format(bond_port), '', 10] > + self.bond_inst.d_console(cmds) > + status =3D self.bond_inst.get_port_info(bond_port, 'link_status'= ) > + if status !=3D 'up': > + msg =3D "bond port {0} fail to set up".format(bond_port) > + self.logger.error(msg) > + raise VerifyFailure(msg) > + else: > + msg =3D "bond port {0} set up successful !".format(bond_port= ) > + self.logger.info(msg) > + > + def check_bonded_device_promisc_mode(self, slaves, bond_port): > + # disable bonded device promiscuous mode > + cmd =3D "set promisc {0} off".format(bond_port) > + self.bond_inst.d_console(cmd) > + time.sleep(2) > + status =3D self.bond_inst.get_port_info(bond_port, 'promiscuous_= mode') > + if status !=3D 'disabled': > + fmt =3D "bond port {0} fail to set promiscuous mode disabled= " > + msg =3D fmt.format(bond_port) > + self.logger.warning(msg) > + else: > + fmt =3D "bond port {0} set promiscuous mode disabled success= ful !" > + msg =3D fmt.format(bond_port) > + self.logger.info(msg) > + self.bond_inst.d_console("start") > + time.sleep(2) > + # check slave promiscuous mode > + for port_id in slaves: > + status =3D self.bond_inst.get_port_info(port_id, 'promiscuou= s_mode') > + if status !=3D 'disabled': > + fmt =3D ("slave port {0} promiscuous mode " > + "isn't the same as bond port 'disabled', ") > + msg =3D fmt.format(port_id) > + self.logger.warning(msg) > + # dpdk developer hasn't completed this function as linux > + # document description about `Promiscuous mode`, ignore = it here > + # temporarily > + #raise VerifyFailure(msg) > + else: > + fmt =3D "slave port {0} promiscuous mode is 'disabled' t= oo" > + msg =3D fmt.format(port_id) > + self.logger.info(msg) > + # enable bonded device promiscuous mode > + cmd =3D "set promisc {0} on".format(bond_port) > + self.bond_inst.d_console(cmd) > + time.sleep(3) > + status =3D self.bond_inst.get_port_info(bond_port, 'promiscuous_= mode') > + if status !=3D 'enabled': > + fmt =3D "bond port {0} fail to set promiscuous mode enabled" > + msg =3D fmt.format(bond_port) > + self.logger.error(msg) > + raise VerifyFailure(msg) > + else: > + fmt =3D "bond port {0} set promiscuous mode enabled successf= ul !" > + msg =3D fmt.format(bond_port) > + self.logger.info(msg) > + # check slave promiscuous mode > + for port_id in slaves: > + status =3D self.bond_inst.get_port_info(port_id, 'promiscuou= s_mode') > + if status !=3D 'enabled': > + fmt =3D "slave port {0} promiscuous mode " + \ > + "isn't the same as bond port 'enabled'" > + msg =3D fmt.format(port_id) > + self.logger.warning(msg) > + # dpdk developer hasn't completed this function as linux > + # document description about `Promiscuous mode`, ignore = it here > + # temporarily > + #raise VerifyFailure(msg) > + else: > + fmt =3D "slave port {0} promiscuous mode is 'enabled' to= o" > + msg =3D fmt.format(port_id) > + self.logger.info(msg) > + > + def check_8023ad_agg_modes(self, slaves, bond_mode): > + ''' check aggregator mode ''' > + check_results =3D [] > + default_agg_mode =3D 'stable' > + for mode in self.AGG_MODES: > + try: > + self.bond_inst.start_testpmd() > + bond_port =3D self.set_8023ad_bonded(slaves, bond_mode) > + cur_agg_mode =3D self.get_8023ad_agg_mode(bond_port) > + if cur_agg_mode !=3D default_agg_mode: > + fmt =3D ("link bonding mode 4 (802.3ad) default agg = mode " > + "isn't {0}") > + msg =3D fmt.format(default_agg_mode) > + self.logger.warning(msg) > + # ignore default mode > + if mode =3D=3D default_agg_mode: > + fmt =3D ("link bonding mode 4 (802.3ad) " > + "current agg mode is {0}") > + msg =3D fmt.format(mode) > + self.logger.info(msg) > + continue > + cmds =3D [ > + ["port stop all", '', 15], > + ["port start all", '', 15]] > + self.bond_inst.d_console(cmds) > + self.set_8023ad_agg_mode(bond_port, mode) > + except Exception as e: > + check_results.append(e); print traceback.format_exc() > + finally: > + self.bond_inst.close_testpmd() > + time.sleep(2) > + > + if check_results: > + for result in check_results: > + self.logger.error(result) > + raise VerifyFailure('check_8023ad_agg_modes is failed') > + > + def check_8023ad_dedicated_queues(self, slaves, bond_mode): > + ''' check 802.3ad dedicated queues ''' > + check_results =3D [] > + default_slow_queue =3D 'unknown' > + for mode in self.DEDICATED_QUEUES: > + try: > + self.bond_inst.start_testpmd() > + bond_port =3D self.set_8023ad_bonded(slaves, bond_mode) > + self.set_8023ad_dedicated_queues(bond_port, mode) > + except Exception as e: > + check_results.append(e); print traceback.format_exc() > + finally: > + self.bond_inst.close_testpmd() > + time.sleep(2) > + > + if check_results: > + for result in check_results: > + self.logger.error(result) > + raise VerifyFailure('check_8023ad_dedicated_queues is > + failed') > + > + def get_commandline_options(self, agg_mode): > + slaves =3D self.dut_ports > + # get bonding port configuration > + slave_pcis =3D self.get_pci_link(slaves) > + # create commandline option format > + bonding_name =3D 'net_bonding0' > + slaves_pci =3D ["slave=3D" + pci for pci in slave_pcis] > + bonding_mode =3D 'mode=3D{0}'.format(str(MODE_LACP)) > + agg_config =3D 'agg_mode=3D{0}' > + vdev_format =3D ",".join([bonding_name] + slaves_pci + \ > + [bonding_mode, agg_config]) > + # command line option > + mode =3D str(MODE_LACP) > + option =3D vdev_format.format(agg_mode) > + vdev_option =3D " --vdev '{0}'".format(option) > + # 802.3ad bond port only create one, it must be the max port num= ber > + bond_port =3D len(self.dut_ports) > + return bond_port, vdev_option > + > + def run_test_pre(self, agg_mode): > + # get bonding port configuration > + bond_port, vdev_option =3D self.get_commandline_options(agg_mode= ) > + self.bond_port =3D bond_port > + # boot up testpmd > + self.bond_inst.start_testpmd(eal_option=3Dvdev_option) > + cur_slaves, cur_agg_mode =3D self.bond_inst.get_bonding_info(bon= d_port, > + ['slaves', 'agg_= mode']) > + if agg_mode !=3D cur_agg_mode: > + fmt =3D 'expected agg mode is [{0}], current agg mode is [{1= }]' > + msg =3D fmt.format(agg_mode, cur_agg_mode) > + self.logger.warning(msg) > + # get forwarding port > + for port_id in range(len(self.dut_ports)): > + # select a non-slave port as forwarding port to do transmitt= ing > + if str(port_id) not in cur_slaves: > + tx_port_id =3D port_id > + break > + else: > + tx_port_id =3D bond_port > + # enable dedicated queue > + self.set_8023ad_dedicated_queues(bond_port, 'enable') > + self.set_bond_port_ready(tx_port_id, bond_port) > + slaves =3D [int(slave) for slave in cur_slaves] > + > + return bond_port, slaves, tx_port_id > + > + def run_dpdk_functional_pre(self): > + mode =3D MODE_LACP > + slaves =3D self.dut_ports[:] > + self.bond_inst.start_testpmd() > + bond_port =3D self.run_8023ad_pre(slaves, mode) > + return slaves, bond_port > + > + def run_dpdk_functional_post(self): > + self.bond_inst.close_testpmd() > + > + def check_cmd_line_option_status(self, agg_mode, bond_port, slaves): > + mode =3D str(MODE_LACP) > + msgs =3D [] > + cur_mode, cur_slaves, cur_active_slaves, cur_agg_mode =3D\ > + self.bond_inst.get_bonding_info(bond_port, > + ['mode', 'slaves', 'active_slaves', 'agg_mod= e']) > + # check bonding mode > + if mode !=3D cur_mode: > + fmt =3D 'expected mode is [{0}], current mode is [{1}]' > + msg =3D fmt.format(mode, cur_mode) > + msgs.append(msg) > + # check bonding 802.3ad agg mode > + if agg_mode !=3D cur_agg_mode: > + fmt =3D'expected agg mode is [{0}], current agg mode is [{1}= ]' > + msg =3D fmt.format(agg_mode, cur_agg_mode) > + msgs.append(msg) > + # check bonded slaves > + _cur_slaves =3D [int(id) for id in cur_slaves] > + if not _cur_slaves or cmp(sorted(slaves), sorted(_cur_slaves)) != =3D 0: > + slaves_str =3D ' '.join([str(id) for id in slaves]) > + cur_slaves_str =3D ' '.join([str(id) for id in _cur_slaves])= \ > + if _cur_slaves else '' > + msg_format =3D 'expected slaves is [{0}], current slaves is = [{1}]' > + msg =3D msg_format.format(slaves_str, cur_slaves_str) > + msgs.append(msg) > + # check active slaves status before ports start > + if self.kdriver is 'i40e': > + if cur_active_slaves: > + check_active_slaves =3D [int(id) for id in cur_active_sl= aves] > + if cmp(sorted(slaves), sorted(check_active_slaves)) !=3D= 0: > + slaves_str =3D ' '.join([str(id) for id in slaves]) > + msg_fmt =3D ('expected active slaves is [{0}], ' > + 'current active slaves is [{1}]') > + msg =3D msg_fmt.format(slaves_str, cur_active_slaves= ) > + msgs.append(msg) > + else: > + msg =3D 'active slaves should not be empty' > + #self.logger.warning(msg) > + #msgs.append(msg) > + else: > + if cur_active_slaves: > + msg =3D 'active slaves should be empty' > + #self.logger.warning(msg) > + #msgs.append(msg) > + # check status after ports start > + self.bond_inst.start_ports() > + # set bonded device to active status > + if self.kdriver is not 'i40e': > + cur_active_slaves =3D [ > + int(id) for id in self.bond_inst.get_bonding_info( > + bond_port, 'active_slave= s')] > + if not cur_active_slaves or cmp(sorted(slaves), > + sorted(cur_active_slaves)) != =3D 0: > + slaves_str =3D ' '.join([str(id) for id in slaves]) > + active_str =3D ' '.join([str(id) for id in cur_active_sl= aves]) \ > + if cur_active_slaves else= '' > + msg_fmt =3D ( > + 'expected active slaves is [{0}], ' > + 'current active slaves is [{1}]') > + msg =3D msg_fmt.format(slaves_str, active_str) > + msgs.append(msg) > + return msgs > + # > + # Test cases. > + # > + def set_up_all(self): > + """ > + Run before each test suite > + """ > + self.verify('bsdapp' not in self.target, "Bonding not support fr= eebsd") > + #------------------------------------------------------------ > + # link peer resource > + self.dut_ports =3D self.dut.get_ports() > + required_link =3D 2 > + self.verify(len(self.dut_ports) >=3D required_link, "Insufficien= t ports") > + #------------------------------------------------------------ > + # 802.3ad related > + self.bond_port =3D None > + self.bond_slave =3D self.dut_ports[0] > + #---------------------------------------------------------------= - > + # initialize bonding common methods name > + config =3D { > + 'parent': self, > + 'pkt_name': 'udp', > + 'pkt_size': FRAME_SIZE_64, > + 'src_mac': '52:00:00:00:00:03', > + 'src_ip': '10.239.129.65', > + 'src_port': 61, > + 'dst_ip': '10.239.129.88', > + 'dst_port': 53,} > + self.bond_inst =3D bonding.PmdBonding(**config) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + try: > + self.bond_inst.close_testpmd() > + except Exception: > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > + > + def test_basic_behav_startStop(self): > + ''' > + test 802.3ad basic behavior(bond port start/stop) > + ''' > + msg =3D '' > + slaves, bond_port =3D self.run_dpdk_functional_pre() > + try: > + for _ in range(10): > + self.check_bonded_device_start(bond_port) > + self.stop_bonded_device(bond_port) > + except Exception as e: > + print traceback.format_exc() > + msg =3D "bonding 8023ad check start/stop failed" > + self.run_dpdk_functional_post() > + if msg: > + raise VerifyFailure(msg) > + > + def test_basic_behav_mac(self): > + ''' > + test 802.3ad basic behavior(bond port mac address) > + ''' > + msg =3D '' > + slaves, bond_port =3D self.run_dpdk_functional_pre() > + try: > + self.bonding_8023ad_check_macs(slaves, bond_port) > + self.check_bonded_device_mac_change(slaves, bond_port) > + except Exception as e: > + msg =3D "bonding 8023ad check mac failed" > + self.run_dpdk_functional_post() > + if msg: > + raise VerifyFailure(msg) > + > + def test_basic_behav_upDown(self): > + ''' > + test 802.3ad basic behavior(bond port link up/down) > + ''' > + msg =3D '' > + slaves, bond_port =3D self.run_dpdk_functional_pre() > + try: > + self.check_bonded_device_up_down(bond_port) > + except Exception as e: > + msg =3D "bonding 8023ad check link up/down failed" > + self.run_dpdk_functional_post() > + if msg: > + raise VerifyFailure(msg) > + > + def test_basic_behav_promisc_mode(self): > + ''' > + test 802.3ad basic behavior(bond port promisc mode) > + ''' > + msg =3D '' > + slaves, bond_port =3D self.run_dpdk_functional_pre() > + try: > + self.check_bonded_device_promisc_mode(slaves, bond_port) > + except Exception as e: > + msg =3D "bonding 8023ad check promisc mode failed" > + self.run_dpdk_functional_post() > + if msg: > + raise VerifyFailure(msg) > + > + def test_command_line_option(self): > + ''' test 802.3ad bonding configs with commandline option ''' > + msgs =3D [] > + for agg_mode in self.AGG_MODES: > + bond_port, cur_slaves, tx_port_id =3D self.run_test_pre(agg_= mode) > + msgs +=3D self.check_cmd_line_option_status( > + agg_mode, bond_port, cur_sla= ves) > + self.bond_inst.close_testpmd() > + if msgs: > + for msg in msgs: > + self.logger.warning(msg) > + msg =3D 'fail to config from command line at {0}'.format(agg= _mode) > + raise VerifyFailure(msg) > + > + def test_basic_behav_agg_mode(self): > + ''' test 802.3ad aggregator mode setting ''' > + mode =3D MODE_LACP > + self.check_8023ad_agg_modes(self.dut_ports, mode) > + > + def test_basic_dedicated_queues(self): > + ''' test 802.3ad dedicated queues setting ''' > + mode =3D MODE_LACP > + self.check_8023ad_dedicated_queues(self.dut_ports, mode) > \ No newline at end of file > -- > 1.9.3