[spp] [PATCH v2 3/4] spp_vm: update retrieving status

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Fri Oct 5 07:06:29 CEST 2018


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

Change from print_active_ports() to get_sec_status_json() to create a
response for status command.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/vm/main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/vm/main.c b/src/vm/main.c
index 16b4c6b..4f3511b 100644
--- a/src/vm/main.c
+++ b/src/vm/main.c
@@ -397,7 +397,6 @@ parse_command(char *str)
 	char *token_list[MAX_PARAMETER] = {NULL};
 	int max_token = 0;
 	int ret = 0;
-	int i;
 
 	if (!str)
 		return 0;
@@ -418,14 +417,15 @@ parse_command(char *str)
 		RTE_LOG(DEBUG, APP, "status\n");
 		memset(str, '\0', MSG_SIZE);
 		if (cmd == FORWARD)
-			i = sprintf(str, "status: running\n");
+			get_sec_stats_json(str, "running", ports_fwd_array,
+					port_map);
 		else
-			i = sprintf(str, "status: idling\n");
-		print_active_ports(str + i, ports_fwd_array, port_map);
+			get_sec_stats_json(str, "idling", ports_fwd_array,
+					port_map);
 
 	} else if (!strcmp(token_list[0], "_get_client_id")) {
 		memset(str, '\0', MSG_SIZE);
-		i = sprintf(str, "%d", client_id);
+		sprintf(str, "%d", client_id);
 
 	} else if (!strcmp(token_list[0], "_set_client_id")) {
 		int id;
-- 
2.7.4



More information about the spp mailing list