From 98b9571f6720a0da06b1d430e7338a0734023232 Mon Sep 17 00:00:00 2001 From: Vishwesh M Rudramuni Date: Mon, 25 Sep 2017 03:36:02 +0530 Subject: REST_API: rest api client implementation JIRA: SAMPLEVNF-78 This patch implements rest api's for VNF clients. This comprises of * vnf api's for common functionality * vnf api's for CGNAPT * vnf api's for VFW Change-Id: I56d22c64bf3ee5b0a2e536da8169ac7583499041 Signed-off-by: Vishwesh M Rudramuni --- VNFs/vFW/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'VNFs/vFW/main.c') diff --git a/VNFs/vFW/main.c b/VNFs/vFW/main.c index 9ebf6fc3..aec04ac5 100644 --- a/VNFs/vFW/main.c +++ b/VNFs/vFW/main.c @@ -15,12 +15,15 @@ */ #include "app.h" +#include static struct app_params app; +extern void rest_api_vfw_init(struct mg_context *ctx, struct app_params *app); int main(int argc, char **argv) { + struct mg_context *ctx = NULL; rte_openlog_stream(stderr); /* Config */ @@ -28,6 +31,12 @@ main(int argc, char **argv) app_config_args(&app, argc, argv); + if (is_rest_support()) { + /* initialize the rest api */ + set_vnf_type("VFW"); + ctx = rest_api_init(&app); + } + app_config_preproc(&app); app_config_parse(&app, app.parser_file); @@ -40,11 +49,21 @@ main(int argc, char **argv) /* Init */ app_init(&app); + if (is_rest_support() && (ctx != NULL)) { + /* rest api's for cgnapt */ + rest_api_vfw_init(ctx, &app); + } + /* Run-time */ rte_eal_mp_remote_launch( app_thread, (void *) &app, CALL_MASTER); + if (is_rest_support() && (ctx != NULL)) { + mg_stop(ctx); + printf("Civet server stopped.\n"); + } + return 0; } -- cgit 1.2.3-korg