From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH v1] framework/config: utilize eval to parse configurations
Date: Sun, 7 Jan 2018 15:23:22 -0500 [thread overview]
Message-ID: <1515356602-45882-1-git-send-email-yong.liu@intel.com> (raw)
Suite config will utilize python eval command to parse configurations.
It will be easy to generate list or dictionary type of suite/case
configuration.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/conf/global_suite.cfg b/conf/global_suite.cfg
index d784fc5..91885a2 100644
--- a/conf/global_suite.cfg
+++ b/conf/global_suite.cfg
@@ -1,2 +1,2 @@
[global]
-vf_driver=pci-stub
\ No newline at end of file
+vf_driver="vfio-pci"
diff --git a/conf/suite_sample.cfg b/conf/suite_sample.cfg
index 434a31e..2467213 100644
--- a/conf/suite_sample.cfg
+++ b/conf/suite_sample.cfg
@@ -1,9 +1,8 @@
# sample for suite configuration
[suite]
-int_value=value_int:10
-hex_value=value_hex:ff
+int_value=int(10)
+hex_value=int("0xff", 16)
[case1]
-string=testpmd
-command=help
-packet_sizes=list_int:64,128,256
-protocals=list_str:TCP,UDP,SCTP
+string="testpmd"
+packet_sizes=[64, 128, 256]
+protocals=["TCP", "UDP", "SCTP"]
diff --git a/framework/config.py b/framework/config.py
index 80f1dd3..f7f347a 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -44,7 +44,6 @@ PORTCONF = "%s/ports.cfg" % CONFIG_ROOT_PATH
CRBCONF = "%s/crbs.cfg" % CONFIG_ROOT_PATH
VIRTCONF = "%s/virt_global.cfg" % CONFIG_ROOT_PATH
IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH
-SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH
GLOBALCONF = "%s/global_suite.cfg" % CONFIG_ROOT_PATH
@@ -142,23 +141,7 @@ class SuiteConf(UserConf):
conf = dict(case_confs)
for key, data_string in conf.items():
- if data_string.startswith("value_int:"):
- value = data_string[len("value_int:"):]
- case_cfg[key] = int(value)
- elif data_string.startswith("value_hex:"):
- value = data_string[len("value_hex:"):]
- case_cfg[key] = int(value, 16)
- elif data_string.startswith("list_int:"):
- value = data_string[len("list_int:"):]
- datas = value.split(',')
- int_list = map(lambda x: int(x), datas)
- case_cfg[key] = int_list
- elif data_string.startswith("list_str:"):
- value = data_string[len("list_str:"):]
- str_list = value.split(',')
- case_cfg[key] = str_list
- else:
- case_cfg[key] = data_string
+ case_cfg[key] = eval(data_string)
return case_cfg
@@ -422,6 +405,6 @@ if __name__ == '__main__':
print ixiaconf.load_ixia_config()
# example for suite configure file
- suiteconf = SuiteConf(SUITECONF_SAMPLE)
+ suiteconf = SuiteConf("suite_sample")
print suiteconf.load_case_config("case1")
print suiteconf.load_case_config("case2")
--
1.9.3
next reply other threads:[~2018-01-08 3:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-07 20:23 Marvin Liu [this message]
2018-01-09 22:55 ` [dts] [PATCH v2] " Marvin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1515356602-45882-1-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).