aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2018-02-01 16:36:12 -0600
committerJohn Lo <loj@cisco.com>2018-02-07 19:24:56 +0000
commit3d460bd9bed8e1b77609ef404018ecfac7c29e9e (patch)
tree2d4d9f2058f6bb0c5ef8142432884a6333b05224 /src/vat
parentfe99a7eeb996633051942b6555b4806592dd8ad0 (diff)
VXLAN: Allow user to specify a custom vxlan tunnel instance id.
If one is not selected by the user, the next available id will be allocated, thus maintaining backward compatibility. Change-Id: I4691ed0638b8072f9cfa9f20b9fe4f981e708800 Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index c133f6b6b9b..fcada258aa9 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -12512,6 +12512,7 @@ api_vxlan_add_del_tunnel (vat_main_t * vam)
u8 src_set = 0;
u8 dst_set = 0;
u8 grp_set = 0;
+ u32 instance = ~0;
u32 mcast_sw_if_index = ~0;
u32 encap_vrf_id = 0;
u32 decap_next_index = ~0;
@@ -12526,6 +12527,8 @@ api_vxlan_add_del_tunnel (vat_main_t * vam)
{
if (unformat (line_input, "del"))
is_add = 0;
+ else if (unformat (line_input, "instance %d", &instance))
+ ;
else
if (unformat (line_input, "src %U", unformat_ip4_address, &src.ip4))
{
@@ -12645,6 +12648,8 @@ api_vxlan_add_del_tunnel (vat_main_t * vam)
clib_memcpy (mp->src_address, &src.ip4, sizeof (src.ip4));
clib_memcpy (mp->dst_address, &dst.ip4, sizeof (dst.ip4));
}
+
+ mp->instance = htonl (instance);
mp->encap_vrf_id = ntohl (encap_vrf_id);
mp->decap_next_index = ntohl (decap_next_index);
mp->mcast_sw_if_index = ntohl (mcast_sw_if_index);
@@ -12664,8 +12669,9 @@ static void vl_api_vxlan_tunnel_details_t_handler
ip46_address_t src = to_ip46 (mp->is_ipv6, mp->dst_address);
ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->src_address);
- print (vam->ofp, "%11d%24U%24U%14d%18d%13d%19d",
+ print (vam->ofp, "%11d%11d%24U%24U%14d%18d%13d%19d",
ntohl (mp->sw_if_index),
+ ntohl (mp->instance),
format_ip46_address, &src, IP46_TYPE_ANY,
format_ip46_address, &dst, IP46_TYPE_ANY,
ntohl (mp->encap_vrf_id),
@@ -12688,6 +12694,9 @@ static void vl_api_vxlan_tunnel_details_t_handler_json
vat_json_init_object (node);
vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
+
+ vat_json_object_add_uint (node, "instance", ntohl (mp->instance));
+
if (mp->is_ipv6)
{
struct in6_addr ip6;
@@ -12741,8 +12750,8 @@ api_vxlan_tunnel_dump (vat_main_t * vam)
if (!vam->json_output)
{
- print (vam->ofp, "%11s%24s%24s%14s%18s%13s%19s",
- "sw_if_index", "src_address", "dst_address",
+ print (vam->ofp, "%11s%11s%24s%24s%14s%18s%13s%19s",
+ "sw_if_index", "instance", "src_address", "dst_address",
"encap_vrf_id", "decap_next_index", "vni", "mcast_sw_if_index");
}
@@ -22867,7 +22876,7 @@ _(l2tpv3_set_lookup_key, \
_(sw_if_l2tpv3_tunnel_dump, "") \
_(vxlan_add_del_tunnel, \
"src <ip-addr> { dst <ip-addr> | group <mcast-ip-addr>\n" \
- "{ <intfc> | mcast_sw_if_index <nn> } }\n" \
+ "{ <intfc> | mcast_sw_if_index <nn> } [instance <id>]}\n" \
"vni <vni> [encap-vrf-id <nn>] [decap-next <l2|nn>] [del]") \
_(geneve_add_del_tunnel, \
"src <ip-addr> { dst <ip-addr> | group <mcast-ip-addr>\n" \