summaryrefslogtreecommitdiffstats
path: root/vpp-api-test/vat
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2016-05-25 01:16:19 +0800
committerFlorin Coras <florin.coras@gmail.com>2016-05-25 10:42:43 +0000
commitdf921cc65a25f6fb71b1169db6ff004b4e45430e (patch)
treef45fb2fe3641c59db8f89acba0bf51cba95ad8b2 /vpp-api-test/vat
parentc4cb44c05d121da2e0f0ccd39d5e1bf470731a85 (diff)
Add Vxlan-Gpe over IPv6
PatchSet4: consolidate code as per comments. PatchSet3: simplify the code using ip_udp_encap_one/two PatchSet2: consolidate comments and indent style Change-Id: Ia8b43f854a46d77e838e198566200ad28fd72472 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'vpp-api-test/vat')
-rw-r--r--vpp-api-test/vat/api_format.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 3fc56d700e6..59da077e053 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -8062,8 +8062,10 @@ static int api_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
unformat_input_t * line_input = vam->input;
vl_api_vxlan_gpe_add_del_tunnel_t *mp;
f64 timeout;
- ip4_address_t local, remote;
+ ip4_address_t local4, remote4;
+ ip6_address_t local6, remote6;
u8 is_add = 1;
+ u8 ipv4_set = 0, ipv6_set = 0;
u8 local_set = 0;
u8 remote_set = 0;
u32 encap_vrf_id = 0;
@@ -8076,11 +8078,29 @@ static int api_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
if (unformat (line_input, "del"))
is_add = 0;
else if (unformat (line_input, "local %U",
- unformat_ip4_address, &local))
+ unformat_ip4_address, &local4))
+ {
+ local_set = 1;
+ ipv4_set = 1;
+ }
+ else if (unformat (line_input, "remote %U",
+ unformat_ip4_address, &remote4))
+ {
+ remote_set = 1;
+ ipv4_set = 1;
+ }
+ else if (unformat (line_input, "local %U",
+ unformat_ip6_address, &local6))
+ {
local_set = 1;
+ ipv6_set = 1;
+ }
else if (unformat (line_input, "remote %U",
- unformat_ip4_address, &remote))
+ unformat_ip6_address, &remote6))
+ {
remote_set = 1;
+ ipv6_set = 1;
+ }
else if (unformat (line_input, "encap-vrf-id %d", &encap_vrf_id))
;
else if (unformat (line_input, "decap-vrf-id %d", &decap_vrf_id))
@@ -8109,6 +8129,10 @@ static int api_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
errmsg ("tunnel remote address not specified\n");
return -99;
}
+ if (ipv4_set && ipv6_set) {
+ errmsg ("both IPv4 and IPv6 addresses specified");
+ return -99;
+ }
if (vni_set == 0) {
errmsg ("vni not specified\n");
@@ -8117,14 +8141,21 @@ static int api_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
M(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel);
- mp->local = local.as_u32;
- mp->remote = remote.as_u32;
+
+ if (ipv6_set) {
+ clib_memcpy(&mp->local, &local6, sizeof(local6));
+ clib_memcpy(&mp->remote, &remote6, sizeof(remote6));
+ } else {
+ clib_memcpy(&mp->local, &local4, sizeof(local4));
+ clib_memcpy(&mp->remote, &remote4, sizeof(remote4));
+ }
+
mp->encap_vrf_id = ntohl(encap_vrf_id);
mp->decap_vrf_id = ntohl(decap_vrf_id);
mp->protocol = ntohl(protocol);
mp->vni = ntohl(vni);
mp->is_add = is_add;
-
+ mp->is_ipv6 = ipv6_set;
S; W;
/* NOTREACHED */