summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--extras/configs/http/setup.http3
-rw-r--r--src/plugins/builtinurl/CMakeLists.txt26
-rw-r--r--src/plugins/builtinurl/FEATURE.yaml13
-rw-r--r--src/plugins/builtinurl/builtins.c194
-rw-r--r--src/plugins/builtinurl/builtinurl.api44
-rw-r--r--src/plugins/builtinurl/builtinurl.c137
-rw-r--r--src/plugins/builtinurl/builtinurl.h57
-rw-r--r--src/plugins/builtinurl/builtinurl_test.c66
-rw-r--r--test/Makefile4
10 files changed, 3 insertions, 546 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index fd456c04a6c..4a65b35bce2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -460,11 +460,6 @@ M: Dave Barach <vpp@barachs.net>
M: Florin Coras <fcoras@cisco.com>
F: src/plugins/http_static/
-Plugin - builtinurl
-I: builtinurl
-M: Dave Barach <vpp@barachs.net>
-F: src/plugins/builtinurl/
-
Plugin - GTPU
I: gtpu
M: Hongjun Ni <hongjun.ni@intel.com>
diff --git a/extras/configs/http/setup.http b/extras/configs/http/setup.http
index 78b7a2f19e8..c4d4d1e6b70 100644
--- a/extras/configs/http/setup.http
+++ b/extras/configs/http/setup.http
@@ -3,5 +3,4 @@ create tap host-if-name lstack host-ip4-addr 192.168.10.2/24
set int ip address tap0 192.168.10.1/24
set int state tap0 up
-http static server www-root <path> uri tcp://0.0.0.0/1234 cache-size 10m fifo-size 2048
-builtinurl enable
+http static server url-handlers www-root <path> uri tcp://0.0.0.0/1234 cache-size 10m fifo-size 2048
diff --git a/src/plugins/builtinurl/CMakeLists.txt b/src/plugins/builtinurl/CMakeLists.txt
deleted file mode 100644
index ddbca5e50f1..00000000000
--- a/src/plugins/builtinurl/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-
-# Copyright (c) <current-year> <your-organization>
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-add_vpp_plugin(builtinurl
- SOURCES
- builtins.c
- builtinurl.c
- builtinurl.h
-
- API_FILES
- builtinurl.api
-
- API_TEST_SOURCES
- builtinurl_test.c
-)
diff --git a/src/plugins/builtinurl/FEATURE.yaml b/src/plugins/builtinurl/FEATURE.yaml
deleted file mode 100644
index ba8e3c7ea7b..00000000000
--- a/src/plugins/builtinurl/FEATURE.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
----
-name: Builtin URL support for the static http or https server
-maintainer: Dave Barach <dave@barachs.net>
-features:
- - Builtin URLs for the static http/https server
-description: "The (builtinurl) plugin adds a set of URLs to the static http/https server.
- Current URLs, all of which return data in .json fmt:
- <root-url>/version.json - vpp version info
- <root-url>/interface_list.json - list of interfaces
- <root-url>/interface_stats - single interface via HTTP POST
- <root-url>/interface_stats - all intfcs via HTTP GET."
-state: development
-properties: [API, CLI, MULTITHREAD]
diff --git a/src/plugins/builtinurl/builtins.c b/src/plugins/builtinurl/builtins.c
deleted file mode 100644
index 6a0975503a7..00000000000
--- a/src/plugins/builtinurl/builtins.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vnet/vnet.h>
-#include <builtinurl/builtinurl.h>
-#include <http_static/http_static.h>
-#include <vpp/app/version.h>
-
-hss_url_handler_rc_t
-handle_get_version (hss_url_handler_args_t *args)
-{
- u8 *s = 0;
-
- /* Build some json bullshit */
- s = format (s, "{\"vpp_details\": {");
- s = format (s, " \"version\": \"%s\",", VPP_BUILD_VER);
- s = format (s, " \"build_date\": \"%s\"}}\r\n", VPP_BUILD_DATE);
-
- args->data = s;
- args->data_len = vec_len (s);
- args->free_vec_data = 1;
- return HSS_URL_HANDLER_OK;
-}
-
-void
-trim_path_from_request (u8 * s, char *path)
-{
- u8 *cp;
- int trim_length = strlen (path) + 1 /* remove '?' */ ;
-
- /* Get rid of the path and question-mark */
- vec_delete (s, trim_length, 0);
-
- /* Tail trim irrelevant browser info */
- cp = s;
- while ((cp - s) < vec_len (s))
- {
- if (*cp == ' ')
- {
- /*
- * Makes request a vector which happens to look
- * like a c-string.
- */
- *cp = 0;
- vec_set_len (s, cp - s);
- break;
- }
- cp++;
- }
-}
-
-hss_url_handler_rc_t
-handle_get_interface_stats (hss_url_handler_args_t *args)
-{
- u8 *s = 0, *stats = 0;
- uword *p;
- u32 *sw_if_indices = 0;
- vnet_hw_interface_t *hi;
- vnet_sw_interface_t *si;
- char *q = "\"";
- int i;
- int need_comma = 0;
- u8 *format_vnet_sw_interface_cntrs (u8 * s, vnet_interface_main_t * im,
- vnet_sw_interface_t * si, int json);
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_main_t *im = &vnm->interface_main;
-
- /* Get stats for a single interface via http POST */
- if (args->req_type == HTTP_REQ_POST)
- {
- /* Find the sw_if_index */
- p = hash_get (im->hw_interface_by_name, args->req_data);
- if (!p)
- {
- s = format (s, "{\"interface_stats\": {[\n");
- s = format (s, " \"name\": \"%s\",", args->req_data);
- s = format (s, " \"error\": \"%s\"", "UnknownInterface");
- s = format (s, "]}\n");
- goto out;
- }
-
- vec_add1 (sw_if_indices, p[0]);
- }
- else /* default, HTTP_BUILTIN_METHOD_GET */
- {
- pool_foreach (hi, im->hw_interfaces)
- {
- vec_add1 (sw_if_indices, hi->sw_if_index);
- }
- }
-
- s = format (s, "{%sinterface_stats%s: [\n", q, q);
-
- for (i = 0; i < vec_len (sw_if_indices); i++)
- {
- si = vnet_get_sw_interface (vnm, sw_if_indices[i]);
- if (need_comma)
- s = format (s, ",\n");
-
- need_comma = 1;
-
- s = format (s, "{%sname%s: %s%U%s, ", q, q, q,
- format_vnet_sw_if_index_name, vnm, sw_if_indices[i], q);
-
- stats = format_vnet_sw_interface_cntrs (stats, &vnm->interface_main, si,
- 1 /* want json */ );
- if (vec_len (stats))
- s = format (s, "%v}", stats);
- else
- s = format (s, "%snone%s: %strue%s}", q, q, q, q);
- vec_reset_length (stats);
- }
-
- s = format (s, "]}\n");
-
-out:
- args->data = s;
- args->data_len = vec_len (s);
- args->free_vec_data = 1;
- vec_free (sw_if_indices);
- vec_free (stats);
- return HSS_URL_HANDLER_OK;
-}
-
-hss_url_handler_rc_t
-handle_get_interface_list (hss_url_handler_args_t *args)
-{
- u8 *s = 0;
- int i;
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_main_t *im = &vnm->interface_main;
- vnet_hw_interface_t *hi;
- u32 *hw_if_indices = 0;
- int need_comma = 0;
-
- /* Construct vector of active hw_if_indexes ... */
- pool_foreach (hi, im->hw_interfaces)
- {
- /* No point in mentioning "local0"... */
- if (hi - im->hw_interfaces)
- vec_add1 (hw_if_indices, hi - im->hw_interfaces);
- }
-
- /* Build answer */
- s = format (s, "{\"interface_list\": [\n");
- for (i = 0; i < vec_len (hw_if_indices); i++)
- {
- if (need_comma)
- s = format (s, ",\n");
- hi = pool_elt_at_index (im->hw_interfaces, hw_if_indices[i]);
- s = format (s, "\"%v\"", hi->name);
- need_comma = 1;
- }
- s = format (s, "]}\n");
- vec_free (hw_if_indices);
-
- args->data = s;
- args->data_len = vec_len (s);
- args->free_vec_data = 1;
- return HSS_URL_HANDLER_OK;
-}
-
-void
-builtinurl_handler_init (builtinurl_main_t * bm)
-{
-
- bm->register_handler (handle_get_version, "version.json", HTTP_REQ_GET);
- bm->register_handler (handle_get_interface_list, "interface_list.json",
- HTTP_REQ_GET);
- bm->register_handler (handle_get_interface_stats, "interface_stats.json",
- HTTP_REQ_GET);
- bm->register_handler (handle_get_interface_stats, "interface_stats.json",
- HTTP_REQ_POST);
-}
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/builtinurl/builtinurl.api b/src/plugins/builtinurl/builtinurl.api
deleted file mode 100644
index 80efa73c725..00000000000
--- a/src/plugins/builtinurl/builtinurl.api
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * builtinurl.api - binary API skeleton
- *
- * Copyright (c) <current-year> <your-organization>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file builtinurl.api
- * @brief VPP control-plane API messages.
- *
- * This file defines VPP control-plane binary API messages which are generally
- * called through a shared memory interface.
- */
-
-/* Version and type recitations */
-
-option version = "1.0.0";
-
-/** @brief API to enable / disable builtinurl on an interface
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param enable_disable - 1 to enable, 0 to disable the feature
- @param sw_if_index - interface handle
-*/
-
-autoreply define builtinurl_enable {
- option deprecated="incorporated in http_static plugin";
- /* Client identifier, set from api_main.my_client_index */
- u32 client_index;
-
- /* Arbitrary context, so client can match reply to request */
- u32 context;
-};
diff --git a/src/plugins/builtinurl/builtinurl.c b/src/plugins/builtinurl/builtinurl.c
deleted file mode 100644
index 749a2c93b8a..00000000000
--- a/src/plugins/builtinurl/builtinurl.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * builtinurl.c - skeleton vpp engine plug-in
- *
- * Copyright (c) 2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vnet/vnet.h>
-#include <vnet/plugin/plugin.h>
-#include <builtinurl/builtinurl.h>
-
-#include <vlibapi/api.h>
-#include <vlibmemory/api.h>
-#include <vpp/app/version.h>
-#include <stdbool.h>
-
-/* define message IDs */
-#include <builtinurl/builtinurl.api_enum.h>
-#include <builtinurl/builtinurl.api_types.h>
-
-#define REPLY_MSG_ID_BASE bmp->msg_id_base
-#include <vlibapi/api_helper_macros.h>
-
-builtinurl_main_t builtinurl_main;
-
-/* Action function shared between message handler and debug CLI */
-
-int
-builtinurl_enable (builtinurl_main_t * bmp)
-{
- void (*fp) (void *, char *, int);
-
- if (bmp->initialized)
- return 0;
-
- /* Look up the builtin URL registration handler */
- fp = vlib_get_plugin_symbol
- ("http_static_plugin.so", "http_static_server_register_builtin_handler");
-
- /* Most likely, the http_static plugin isn't loaded. Done. */
- if (fp == 0)
- return VNET_API_ERROR_NO_SUCH_TABLE;
-
- bmp->register_handler = fp;
- builtinurl_handler_init (bmp);
- bmp->initialized = 1;
-
- return 0;
-}
-
-static clib_error_t *
-builtinurl_enable_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- builtinurl_main_t *bmp = &builtinurl_main;
-
- int rv;
-
- rv = builtinurl_enable (bmp);
-
- switch (rv)
- {
- case 0:
- break;
-
- case VNET_API_ERROR_NO_SUCH_TABLE:
- return clib_error_return
- (0, "http_static_server_register_builtin_handler undefined");
- break;
-
- default:
- return clib_error_return (0, "builtinurl_enable returned %d", rv);
- }
- return 0;
-}
-
-VLIB_CLI_COMMAND (builtinurl_enable_command, static) =
-{
- .path = "builtinurl enable",
- .short_help = "Turn on builtin http/https GET and POST urls",
- .function = builtinurl_enable_command_fn,
-};
-
-/* API message handler */
-static void vl_api_builtinurl_enable_t_handler
- (vl_api_builtinurl_enable_t * mp)
-{
- vl_api_builtinurl_enable_reply_t *rmp;
- builtinurl_main_t *bmp = &builtinurl_main;
- int rv;
-
- rv = builtinurl_enable (bmp);
-
- REPLY_MACRO (VL_API_BUILTINURL_ENABLE_REPLY);
-}
-
-#include <builtinurl/builtinurl.api.c>
-static clib_error_t *
-builtinurl_init (vlib_main_t * vm)
-{
- builtinurl_main_t *bmp = &builtinurl_main;
-
- bmp->vlib_main = vm;
- bmp->vnet_main = vnet_get_main ();
-
- /* Ask for a correctly-sized block of API message decode slots */
- bmp->msg_id_base = setup_message_id_table ();
-
- return 0;
-}
-
-VLIB_INIT_FUNCTION (builtinurl_init);
-
-VLIB_PLUGIN_REGISTER () =
-{
- .version = VPP_BUILD_VER,
- .description = "vpp built-in URL support",
-};
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/builtinurl/builtinurl.h b/src/plugins/builtinurl/builtinurl.h
deleted file mode 100644
index 91302c1eee5..00000000000
--- a/src/plugins/builtinurl/builtinurl.h
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/*
- * builtinurl.h - built-in URLs for the http static server
- *
- * Copyright (c) 2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __included_builtinurl_h__
-#define __included_builtinurl_h__
-
-#include <vnet/vnet.h>
-#include <vnet/ip/ip.h>
-#include <vnet/ethernet/ethernet.h>
-
-#include <vppinfra/hash.h>
-#include <vppinfra/error.h>
-
-typedef struct
-{
- /* API message ID base */
- u16 msg_id_base;
-
- /* GET / POST handler registration function */
- void (*register_handler) (void *, char *, int);
-
- /* Been there, done that */
- int initialized;
-
- /* convenience */
- vlib_main_t *vlib_main;
- vnet_main_t *vnet_main;
- ethernet_main_t *ethernet_main;
-} builtinurl_main_t;
-
-extern builtinurl_main_t builtinurl_main;
-
-void builtinurl_handler_init (builtinurl_main_t * bm);
-
-#endif /* __included_builtinurl_h__ */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/builtinurl/builtinurl_test.c b/src/plugins/builtinurl/builtinurl_test.c
deleted file mode 100644
index 9edfb81c525..00000000000
--- a/src/plugins/builtinurl/builtinurl_test.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * builtinurl.c - skeleton vpp-api-test plug-in
- *
- * Copyright (c) 2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vat/vat.h>
-#include <vlibapi/api.h>
-#include <vlibmemory/api.h>
-#include <vppinfra/error.h>
-#include <stdbool.h>
-
-uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
-
-/* Declare message IDs */
-#include <builtinurl/builtinurl.api_enum.h>
-#include <builtinurl/builtinurl.api_types.h>
-
-typedef struct
-{
- /* API message ID base */
- u16 msg_id_base;
- vat_main_t *vat_main;
-} builtinurl_test_main_t;
-
-builtinurl_test_main_t builtinurl_test_main;
-
-#define __plugin_msg_base builtinurl_test_main.msg_id_base
-#include <vlibapi/vat_helper_macros.h>
-
-static int
-api_builtinurl_enable (vat_main_t * vam)
-{
- vl_api_builtinurl_enable_t *mp;
- int ret;
-
- /* Construct the API message */
- M (BUILTINURL_ENABLE, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#include <builtinurl/builtinurl.api_test.c>
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/test/Makefile b/test/Makefile
index 77c95a87424..5439083d7c1 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -388,8 +388,8 @@ COV_REM_TODO_NO_TEST="*/vpp-api/client/*" "*/plugins/prom/*" \
"*/vnet/ethernet/ethernet_format_fns.h" \
"*/plugins/ikev2/ikev2_format.c" "*/vnet/bier/bier_types.c"
-COV_REM_ALT_TEST="*/plugins/hs_apps/*" "*/plugins/builtinurl/*" \
- "*/plugins/http/*.h"
+COV_REM_ALT_TEST="*/plugins/hs_apps/*" "*/plugins/http/*.h"
+
.PHONY: cov-post
cov-post: wipe-cov $(BUILD_COV_DIR)
@lcov --capture \