sr: move srmpls to a plugin

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>
This commit is contained in:
Scott Hutton
2024-05-03 07:40:42 -07:00
committed by Damjan Marion
parent 9850d301b0
commit 182d8b2ddb
15 changed files with 73 additions and 36 deletions

View 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

View File

@ -1 +1 @@
../../../../src/vnet/srmpls/sr_doc.rst
../../../../src/plugins/srmpls/sr_doc.rst

View File

@ -1047,6 +1047,7 @@ srcIP
srcPortDefinition
srcUP
srh
srmpls
Srmpls
srtp
SRTP

View File

@ -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
)

View File

@ -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",
};

View 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>
@ -26,28 +26,27 @@
#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

View 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>

View 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>

View File

@ -25,11 +25,11 @@
/* 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

View 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