sr: move srmpls to a plugin 66/40866/10
authorScott Hutton <schutton@cisco.com>
Fri, 3 May 2024 14:40:42 +0000 (07:40 -0700)
committerDamjan Marion <dmarion@0xa5.net>
Tue, 14 May 2024 07:53:35 +0000 (07:53 +0000)
Move sr_mpls folder under vnet to the plugin folder, update cmake configuration
and header paths, and add plugin.c to register plugin.

JIRA: VPP-2054

Type: improvement
Change-Id: I1ad6f287f67eb0c35588c339bcd51218fadf5f8e
Signed-off-by: Scott Hutton <schutton@cisco.com>
15 files changed:
MAINTAINERS
docs/developer/corefeatures/sr/sr_mpls.rst
docs/spelling_wordlist.txt
src/plugins/srmpls/CMakeLists.txt [new file with mode: 0644]
src/plugins/srmpls/FEATURE.yaml [moved from src/vnet/srmpls/FEATURE.yaml with 100% similarity]
src/plugins/srmpls/dir.dox [moved from src/vnet/srmpls/dir.dox with 100% similarity]
src/plugins/srmpls/plugin.c [new file with mode: 0644]
src/plugins/srmpls/sr_doc.rst [moved from src/vnet/srmpls/sr_doc.rst with 100% similarity]
src/plugins/srmpls/sr_mpls.api [moved from src/vnet/srmpls/sr_mpls.api with 100% similarity]
src/plugins/srmpls/sr_mpls.h [moved from src/vnet/srmpls/sr_mpls.h with 100% similarity]
src/plugins/srmpls/sr_mpls_api.c [moved from src/vnet/srmpls/sr_mpls_api.c with 96% similarity]
src/plugins/srmpls/sr_mpls_policy.c [moved from src/vnet/srmpls/sr_mpls_policy.c with 99% similarity]
src/plugins/srmpls/sr_mpls_steering.c [moved from src/vnet/srmpls/sr_mpls_steering.c with 99% similarity]
src/plugins/srmpls/sr_mpls_test.c [moved from src/vnet/srmpls/sr_mpls_test.c with 95% similarity]
src/vnet/CMakeLists.txt

index abc7faf..fd456c0 100644 (file)
@@ -192,7 +192,7 @@ I:  sr
 M:     Pablo Camarillo <pcamaril@cisco.com>
 M:     Ahmed Abdelsalam <ahabdels@cisco.com>
 F:     src/vnet/srv6/
-F:     src/vnet/srmpls/
+F:     src/plugin/srmpls/
 F:     src/examples/srv6-sample-localsid/
 
 VNET IPSec
index d2fe402..9e676db 120000 (symlink)
@@ -1 +1 @@
-../../../../src/vnet/srmpls/sr_doc.rst
\ No newline at end of file
+../../../../src/plugins/srmpls/sr_doc.rst
\ No newline at end of file
index 2348c8d..f90ffa8 100644 (file)
@@ -1047,6 +1047,7 @@ srcIP
 srcPortDefinition
 srcUP
 srh
+srmpls
 Srmpls
 srtp
 SRTP
diff --git a/src/plugins/srmpls/CMakeLists.txt b/src/plugins/srmpls/CMakeLists.txt
new file mode 100644 (file)
index 0000000..25905d3
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (c) 2024 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.
+
+add_vpp_plugin(srmpls
+  SOURCES
+  sr_mpls_policy.c
+  sr_mpls_steering.c
+  sr_mpls_api.c
+  plugin.c
+
+  INSTALL_HEADERS
+  sr_mpls.h
+
+  API_FILES
+  sr_mpls.api
+
+  # This might need to be VAT_AUTO_TEST? Not documented
+  API_TEST_SOURCES
+  sr_mpls_test.c
+)
diff --git a/src/plugins/srmpls/plugin.c b/src/plugins/srmpls/plugin.c
new file mode 100644 (file)
index 0000000..af87607
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * plugin.c: srmpls
+ *
+ * Copyright (c) 2024 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 <vlib/vlib.h>
+#include <vnet/plugin/plugin.h>
+#include <vpp/app/version.h>
+
+// register a plugin
+VLIB_PLUGIN_REGISTER () = {
+  .version = VPP_BUILD_VER,
+  .description = "Segment Routing for MPLS plugin",
+};
similarity index 96%
rename from src/vnet/srmpls/sr_mpls_api.c
rename to src/plugins/srmpls/sr_mpls_api.c
index 920856a..3e89017 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include <vnet/vnet.h>
-#include <vnet/srmpls/sr_mpls.h>
+#include "sr_mpls.h"
 #include <vlibmemory/api.h>
 
 #include <vnet/interface.h>
 #include <vnet/ip/ip_types_api.h>
 
 #include <vnet/format_fns.h>
-#include <vnet/srmpls/sr_mpls.api_enum.h>
-#include <vnet/srmpls/sr_mpls.api_types.h>
-
+#include <plugins/srmpls/sr_mpls.api_enum.h>
+#include <plugins/srmpls/sr_mpls.api_types.h>
 
 #define vl_api_version(n, v) static u32 api_version = v;
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_api_version
 
 #define vl_endianfun
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_endianfun
 
 #define vl_calcsizefun
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_calcsizefun
 
 #define vl_printfun
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_printfun
 
 #define vl_msg_name_crc_list
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_msg_name_crc_list
 
 #define REPLY_MSG_ID_BASE msg_id_base
similarity index 99%
rename from src/vnet/srmpls/sr_mpls_policy.c
rename to src/plugins/srmpls/sr_mpls_policy.c
index 41cb716..af24acd 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
-#include <vnet/srmpls/sr_mpls.h>
+#include "sr_mpls.h"
 #include <vnet/fib/mpls_fib.h>
 #include <vnet/dpo/dpo.h>
 #include <vnet/ip/ip.h>
similarity index 99%
rename from src/vnet/srmpls/sr_mpls_steering.c
rename to src/plugins/srmpls/sr_mpls_steering.c
index e8920df..24c8b0e 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
-#include <vnet/srmpls/sr_mpls.h>
+#include "sr_mpls.h"
 #include <vnet/ip/ip4_packet.h>
 #include <vnet/ip/ip6_packet.h>
 #include <vnet/fib/mpls_fib.h>
similarity index 95%
rename from src/vnet/srmpls/sr_mpls_test.c
rename to src/plugins/srmpls/sr_mpls_test.c
index e5d6846..7aff4c3 100644 (file)
 
 /* Declare message IDs */
 #include <vnet/format_fns.h>
-#include <vnet/srmpls/sr_mpls.api_enum.h>
-#include <vnet/srmpls/sr_mpls.api_types.h>
+#include <plugins/srmpls/sr_mpls.api_enum.h>
+#include <plugins/srmpls/sr_mpls.api_types.h>
 
 #define vl_endianfun /* define message structures */
-#include <vnet/srmpls/sr_mpls.api.h>
+#include <plugins/srmpls/sr_mpls.api.h>
 #undef vl_endianfun
 
 typedef struct
@@ -163,7 +163,7 @@ api_sr_mpls_policy_del (vat_main_t *vam)
   return ret;
 }
 
-#include <vnet/srmpls/sr_mpls.api_test.c>
+#include <plugins/srmpls/sr_mpls.api_test.c>
 
 /*
  * fd.io coding-style-patch-verification: ON
index fb8d294..ad5f448 100644 (file)
@@ -812,24 +812,6 @@ list(APPEND VNET_API_FILES
   srv6/sr_pt.api
 )
 
-##############################################################################
-# mpls segment routing
-##############################################################################
-
-list(APPEND VNET_SOURCES
-  srmpls/sr_mpls_policy.c
-  srmpls/sr_mpls_steering.c
-  srmpls/sr_mpls_api.c
-)
-
-list(APPEND VNET_HEADERS
-  srmpls/sr_mpls.h
-)
-
-list(APPEND VNET_API_FILES
-  srmpls/sr_mpls.api
-)
-
 ##############################################################################
 # IPFIX / netflow v10
 ##############################################################################
@@ -1460,7 +1442,6 @@ add_vat_test_library(vnet
   ip/ip_test.c
   arp/arp_test.c
   ip6-nd/ip6_nd_test.c
-  srmpls/sr_mpls_test.c
   session/session_test.c
   l2/l2_test.c
   ipsec/ipsec_test.c