From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 08D141B7DA for ; Wed, 6 Jun 2018 07:38:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 22:38:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,482,1520924400"; d="scan'208";a="47109264" Received: from shecgisg006.sh.intel.com ([10.239.39.68]) by orsmga008.jf.intel.com with ESMTP; 05 Jun 2018 22:38:35 -0700 Received: from shecgisg006.sh.intel.com (localhost [127.0.0.1]) by shecgisg006.sh.intel.com with ESMTP id w565cY9w026703; Wed, 6 Jun 2018 13:38:34 +0800 Received: (from yufengmx@localhost) by shecgisg006.sh.intel.com with œ id w565cY6h026699; Wed, 6 Jun 2018 13:38:34 +0800 From: yufengx.mo@intel.com To: dts@dpdk.org Cc: yufengmx Date: Wed, 6 Jun 2018 13:38:31 +0800 Message-Id: <1528263513-26500-5-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1528263513-26500-1-git-send-email-yufengx.mo@intel.com> References: <1528263513-26500-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 4/6] pmd_bonded_8023ad: dts configuration files 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: Wed, 06 Jun 2018 05:38:37 -0000 From: yufengmx add dts configuration support for switch equipment Signed-off-by: yufengmx --- conf/crbs.cfg | 2 ++ conf/ports.cfg | 2 ++ conf/switch.cfg | 27 ++++++++++++++++++++++++ framework/config.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 conf/switch.cfg diff --git a/conf/crbs.cfg b/conf/crbs.cfg index 0a17c35..9307d48 100644 --- a/conf/crbs.cfg +++ b/conf/crbs.cfg @@ -7,6 +7,7 @@ # tester_ip: Tester ip address # tester_passwd: Tester password # ixia_group: IXIA group name +# switch_group: switch group name # channels: Board channel number # bypass_core0: Whether by pass core0 [DUT IP1] @@ -27,5 +28,6 @@ os=linux tester_ip=yyy.yyy.yyy.yyy tester_passwd= ixia_group= +switch_group= channels=4 bypass_core0=True diff --git a/conf/ports.cfg b/conf/ports.cfg index 7fa7aae..97157c4 100644 --- a/conf/ports.cfg +++ b/conf/ports.cfg @@ -4,6 +4,7 @@ # 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 +# pci=Pci BDF,peer=SWITCH:port # pci=Pci BDF,peer=Tester Pci BDF,tp_ip=$(IP),tp_path=$({PERL_PATH); # pci=Pci BDF,peer=Tester Pci BDF,sec_port=yes,first_port=Pci BDF; # [VM NAME] virtual machine name; This section is for virutal scenario @@ -14,6 +15,7 @@ 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=ZZ:ZZ.Y,peer=IXIA:X.Y; + pci=ZZ:ZZ.Y,peer=SWITCH:XXY; pci=0000:XX:XX.X,peer=0000:ZZ:ZZ.Z,tp_ip=127.0.0.1,tp_path=/home/libertyTrailTP_322291/perl; pci=0000:YY:YY.Y,peer=0000:ZZ:ZZ.Z,sec_port=yes,first_port=XX:XX.X; [VM NAME] diff --git a/conf/switch.cfg b/conf/switch.cfg new file mode 100644 index 0000000..aa3de22 --- /dev/null +++ b/conf/switch.cfg @@ -0,0 +1,27 @@ +# switch port Configuration +# switch_Group1: a name of switch work scence +# manufacture: switch manufacture +# model: switch device model +# ip: switch device IP address +# user: switch device user name +# passwd: switch device user password +# auto_config: switch auto config resources(True or False) +# scene: switch work scene +# vlan: switch vlan id +# port-channel: port-channel id +# ports: [switch port list] +[switch_Group1] +manufacturer=xxxxxx +model=xxxxxx +ip=xxx.xxx.xxx.xxx +user=xxxx +passwd=xxxx +auto_config=xxxx +scene=xxxx +vlan=xxx +port-channel=xxxx +ports= + xxx; + xxx; + xxx; + xxx; diff --git a/framework/config.py b/framework/config.py index 71b1c37..749e979 100644 --- a/framework/config.py +++ b/framework/config.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2018 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ import ConfigParser # config parse module import argparse # prase arguments module from settings import IXIA, CONFIG_ROOT_PATH, SUITE_SECTION_NAME from settings import load_global_setting, DTS_CFG_FOLDER +from settings import SWITCH from exception import ConfigParseException, VirtConfigParseException, PortConfigParseException PORTCONF = "%s/ports.cfg" % CONFIG_ROOT_PATH @@ -45,7 +46,7 @@ CRBCONF = "%s/crbs.cfg" % CONFIG_ROOT_PATH VIRTCONF = "%s/virt_global.cfg" % CONFIG_ROOT_PATH IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH GLOBALCONF = "%s/global_suite.cfg" % CONFIG_ROOT_PATH - +SWITCHCONF = "%s/switch.cfg" % CONFIG_ROOT_PATH class UserConf(): @@ -249,6 +250,7 @@ class CrbsConf(UserConf): DEF_CRB = {'IP': '', 'board': 'default', 'user': '', 'pass': '', 'tester IP': '', 'tester pass': '', IXIA: None, 'memory channels': 4, + SWITCH: None, 'bypass core0': True} def __init__(self, crbs_conf=CRBCONF): @@ -292,6 +294,11 @@ class CrbsConf(UserConf): if value.lower() == 'none': value = None crb[IXIA] = value + elif key == 'switch_group': + # None type will be check later + if value.lower() == 'none': + value = None + crb[SWITCH] = value elif key == 'channels': crb['memory channels'] = int(value) elif key == 'bypass_core0': @@ -364,6 +371,56 @@ class IxiaConf(UserConf): return self.ixia_cfg + +class SwitchConf(UserConf): + + def __init__(self, switch_conf=SWITCHCONF): + self.config_file = switch_conf + self.switch_cfg = {} + try: + self.switch_conf = UserConf(self.config_file) + except ConfigParseException: + self.switch_conf = None + raise ConfigParseException + + def load_switch_config(self): + port_reg = r'(\S+)' + groups = self.switch_conf.get_sections() + if not groups: + return self.switch_cfg + + keywords = ['manufacturer', 'model', 'ip', 'user', 'passwd', 'scene', + 'vlan', 'port-channel', 'ports', 'auto_config'] + required_keywords = ['manufacturer', 'model', 'ip', 'user', 'passwd'] + for group in groups: + switch_group = {} + switch_confs = self.switch_conf.load_section(group) + if not switch_confs: + continue + # convert file configuration to dts switchcfg + for conf in switch_confs: + _key, value = conf + key = _key.lower() + if key == 'ports': + ports = self.switch_conf.load_config(value) + switch_ports = [] + for port in ports: + m = re.findall(port_reg, port) + switch_ports += [port.strip() for port in m] + switch_group['ports'] = switch_ports + elif key in keywords: + switch_group[key] = value + + msg_fmt = 'switch configuration file request {0} option!!!'.format + for i in required_keywords: + if i not in switch_group: + print msg_fmt(i) + + self.switch_cfg[group] = switch_group + + return self.switch_cfg + + if __name__ == '__main__': parser = argparse.ArgumentParser( description="Load DTS configuration files") -- 1.9.3