From 6ff96593f173b318cdb5363a2c8ab24a6e62bd5f Mon Sep 17 00:00:00 2001 From: zhanglianghy Date: Thu, 11 Jul 2019 18:32:22 +0800 Subject: [PATCH] =?UTF-8?q?MOD=20aaa-12=20=E4=BC=98=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BB=A3=E7=A0=81=20SOL=20=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=BA=EF=BC=9Azhangliang=20=E6=A3=80=E8=A7=86=E4=BA=BA?= =?UTF-8?q?=EF=BC=9Azhangliang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Platform/user/configm/config-test/ReadMe.txt | 8 ++++++++ Platform/user/configm/config-test/configtest.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 Platform/user/configm/config-test/ReadMe.txt diff --git a/Platform/user/configm/config-test/ReadMe.txt b/Platform/user/configm/config-test/ReadMe.txt new file mode 100644 index 000000000..569310a86 --- /dev/null +++ b/Platform/user/configm/config-test/ReadMe.txt @@ -0,0 +1,8 @@ +配置测试步骤: +1、在configmtest-linux.exe或者configmtest-arm64.exe的目录下面创建文本文档,文本文档名字为config id的16进制形式,例如ip配置的文件名为0x0000000100000001 +2、在文档中输入需要测试的json字符串,例如:{"config_type":3,"ifname":"ens3","family":2,"ipaddr":"192.168.12.12","prefixlen":24};每一行为一条完整配置,支持多个配置 +3、启动configm-linux.exe或者configm-arm64.ext +4、启动测试进程,参数名为创建的文件名,例如./configmtest-linux.exe 0x0000000100000001查看结果打印,如果成功会有打印信息,例如: + config id:0x100000001 + configure: {"config_type":5} + call config type retturn:OK,result:[{"config_type":4,"ifname":"lo","family":2,"ipaddr":"127.0.0.1","prefixlen":8},{"config_type":4,"ifname":"ens3","family":2,"ipaddr":"172.28.72.52","prefixlen":24}] \ No newline at end of file diff --git a/Platform/user/configm/config-test/configtest.c b/Platform/user/configm/config-test/configtest.c index 2d5cdf320..341874f6e 100644 --- a/Platform/user/configm/config-test/configtest.c +++ b/Platform/user/configm/config-test/configtest.c @@ -10,15 +10,20 @@ int main(int argc, char **argv) char config_linebuf[512]; char* output = NULL; int output_len; + long int config_id; ret_code code; + char *stop; if(argc != 2 ) { printf("input error!\n"); return EXIT_FAILURE; } - - f = fopen("configtest","r+"); + + config_id = strtol(argv[1], &stop, 16); + printf("config id:0x%lx\n",config_id); + + f = fopen(argv[1],"r+"); if(f == NULL) { printf("OPEN CONFIG test file FALID\n"); @@ -31,7 +36,7 @@ int main(int argc, char **argv) printf("configure: %s\n", config_linebuf); - code = web_config_exec_sync(CM_CONFIG_GET, IPCONFIG_V4, + code = web_config_exec_sync(CM_CONFIG_GET, config_id, config_linebuf, strlen(config_linebuf) + 1, &output, &output_len); printf("call config type retturn:%s,result:%s\n", rpc_code_format(code), output);