lisp: API cleanup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ib7f73a0b6de188982a09040f7739dc46be3cb1de Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -898,6 +898,7 @@ list(APPEND VNET_SOURCES
|
||||
lisp-cp/lisp_cli.c
|
||||
lisp-cp/one_api.c
|
||||
lisp-cp/lisp_api.c
|
||||
lisp-cp/lisp_types_api.c
|
||||
)
|
||||
|
||||
list(APPEND VNET_HEADERS
|
||||
@ -907,8 +908,10 @@ list(APPEND VNET_HEADERS
|
||||
lisp-cp/lisp_cp_messages.h
|
||||
lisp-cp/lisp_msg_serdes.h
|
||||
lisp-cp/control.h
|
||||
lisp-cp/lisp_types_api.h
|
||||
)
|
||||
|
||||
list(APPEND VNET_API_FILES lisp-cp/lisp_types.api)
|
||||
list(APPEND VNET_API_FILES lisp-cp/lisp.api)
|
||||
list(APPEND VNET_API_FILES lisp-cp/one.api)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
75
src/vnet/lisp-cp/lisp_types.api
Normal file
75
src/vnet/lisp-cp/lisp_types.api
Normal file
@ -0,0 +1,75 @@
|
||||
/* Hey Emacs use -*- mode: C -*- */
|
||||
/*
|
||||
* Copyright (c) 2020 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.
|
||||
*/
|
||||
|
||||
option version = "1.0.0";
|
||||
|
||||
import "vnet/interface_types.api";
|
||||
import "vnet/ethernet/ethernet_types.api";
|
||||
import "vnet/ip/ip_types.api";
|
||||
|
||||
typedef local_locator
|
||||
{
|
||||
vl_api_interface_index_t sw_if_index;
|
||||
u8 priority;
|
||||
u8 weight;
|
||||
};
|
||||
|
||||
typedef remote_locator
|
||||
{
|
||||
u8 priority;
|
||||
u8 weight;
|
||||
vl_api_address_t ip_address;
|
||||
};
|
||||
|
||||
enum eid_type : u8
|
||||
{
|
||||
EID_TYPE_API_PREFIX = 0,
|
||||
EID_TYPE_API_MAC = 1,
|
||||
EID_TYPE_API_NSH = 2,
|
||||
};
|
||||
|
||||
typedef nsh
|
||||
{
|
||||
u32 spi;
|
||||
u8 si;
|
||||
};
|
||||
|
||||
union eid_address
|
||||
{
|
||||
vl_api_prefix_t prefix;
|
||||
vl_api_mac_address_t mac;
|
||||
vl_api_nsh_t nsh;
|
||||
};
|
||||
|
||||
/* endpoint identifier */
|
||||
typedef eid
|
||||
{
|
||||
vl_api_eid_type_t type;
|
||||
vl_api_eid_address_t address;
|
||||
};
|
||||
|
||||
enum hmac_key_id : u8
|
||||
{
|
||||
KEY_ID_API_HMAC_NO_KEY = 0,
|
||||
KEY_ID_API_HMAC_SHA_1_96 = 1,
|
||||
KEY_ID_API_HMAC_SHA_256_128 = 2,
|
||||
};
|
||||
|
||||
typedef hmac_key
|
||||
{
|
||||
vl_api_hmac_key_id_t id;
|
||||
u8 key[64];
|
||||
};
|
88
src/vnet/lisp-cp/lisp_types_api.c
Normal file
88
src/vnet/lisp-cp/lisp_types_api.c
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
*------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2020 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/lisp-cp/lisp_types_api.h>
|
||||
#include <vnet/ip/ip_types_api.h>
|
||||
#include <vnet/ethernet/ethernet_types_api.h>
|
||||
|
||||
int
|
||||
unformat_lisp_eid_api (gid_address_t * dst, u32 vni, const vl_api_eid_t * eid)
|
||||
{
|
||||
switch (eid->type)
|
||||
{
|
||||
case EID_TYPE_API_PREFIX: /* ip prefix */
|
||||
gid_address_type (dst) = GID_ADDR_IP_PREFIX;
|
||||
ip_address_decode2 (&eid->address.prefix.address, &dst->ippref.addr);
|
||||
gid_address_ippref_len (dst) = eid->address.prefix.len;
|
||||
ip_prefix_normalize (&gid_address_ippref (dst));
|
||||
break;
|
||||
case EID_TYPE_API_MAC: /* l2 mac */
|
||||
gid_address_type (dst) = GID_ADDR_MAC;
|
||||
mac_address_decode (eid->address.mac, (mac_address_t *) gid_address_mac (dst));
|
||||
break;
|
||||
default:
|
||||
/* unknown type */
|
||||
return VNET_API_ERROR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
gid_address_vni (dst) = clib_net_to_host_u32 (vni);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
lisp_fid_put_api (vl_api_eid_t * eid, const fid_address_t * fid)
|
||||
{
|
||||
switch (fid_addr_type (fid))
|
||||
{
|
||||
case FID_ADDR_IP_PREF:
|
||||
ip_prefix_encode2 (&fid_addr_ippref (fid), &eid->address.prefix);
|
||||
eid->type = EID_TYPE_API_PREFIX;
|
||||
break;
|
||||
|
||||
case FID_ADDR_MAC:
|
||||
mac_address_encode ((mac_address_t *) fid_addr_mac (fid), eid->address.mac);
|
||||
eid->type = EID_TYPE_API_MAC;
|
||||
break;
|
||||
|
||||
default:
|
||||
clib_warning ("Unknown FID type %d!", fid_addr_type (fid));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lisp_gid_put_api (vl_api_eid_t * eid, const gid_address_t * gid)
|
||||
{
|
||||
switch (gid_address_type (gid))
|
||||
{
|
||||
case GID_ADDR_IP_PREFIX:
|
||||
ip_prefix_encode2 (&gid_address_ippref (gid), &eid->address.prefix);
|
||||
eid->type = EID_TYPE_API_PREFIX;
|
||||
break;
|
||||
|
||||
case GID_ADDR_MAC:
|
||||
mac_address_encode ((mac_address_t *) gid_address_mac (gid), eid->address.mac);
|
||||
eid->type = EID_TYPE_API_MAC;
|
||||
break;
|
||||
|
||||
default:
|
||||
clib_warning ("Unknown GID type %d!", gid_address_type (gid));
|
||||
break;
|
||||
}
|
||||
}
|
26
src/vnet/lisp-cp/lisp_types_api.h
Normal file
26
src/vnet/lisp-cp/lisp_types_api.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
*------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2020 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/lisp-cp/lisp_types.h>
|
||||
#include <vnet/lisp-cp/lisp.api_types.h>
|
||||
|
||||
int unformat_lisp_eid_api (gid_address_t * dst, u32 vni, const vl_api_eid_t * eid);
|
||||
|
||||
void lisp_fid_put_api (vl_api_eid_t * eid, const fid_address_t * fid);
|
||||
|
||||
void lisp_gid_put_api (vl_api_eid_t * eid, const gid_address_t * gid);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
option version = "1.0.0";
|
||||
option version = "2.0.0";
|
||||
|
||||
import "vnet/interface_types.api";
|
||||
import "vnet/lisp-cp/lisp_types.api";
|
||||
|
||||
/** \brief GPE locator structure
|
||||
@param is_ip4 - whether addr is IPv4 or v6
|
||||
@ -22,9 +25,8 @@ option version = "1.0.0";
|
||||
*/
|
||||
typedef gpe_locator
|
||||
{
|
||||
u8 is_ip4;
|
||||
u8 weight;
|
||||
u8 addr[16];
|
||||
vl_api_address_t addr;
|
||||
};
|
||||
|
||||
/** \brief add or delete GPE tunnel
|
||||
@ -49,12 +51,9 @@ manual_print manual_endian define gpe_add_del_fwd_entry
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 is_add;
|
||||
u8 eid_type;
|
||||
u8 rmt_eid[16];
|
||||
u8 lcl_eid[16];
|
||||
u8 rmt_len;
|
||||
u8 lcl_len;
|
||||
bool is_add [default=true];
|
||||
vl_api_eid_t rmt_eid;
|
||||
vl_api_eid_t lcl_eid;
|
||||
u32 vni;
|
||||
u32 dp_table;
|
||||
u8 action;
|
||||
@ -72,13 +71,13 @@ define gpe_add_del_fwd_entry_reply
|
||||
/** \brief enable or disable gpe protocol
|
||||
@param client_index - opaque cookie to identify the sender
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param is_en - enable protocol if non-zero, else disable
|
||||
@param is_enable [default=true] - enable protocol if non-zero, else disable
|
||||
*/
|
||||
autoreply define gpe_enable_disable
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 is_en;
|
||||
bool is_enable [default=true];
|
||||
};
|
||||
|
||||
/** \brief add or delete gpe_iface
|
||||
@ -90,8 +89,8 @@ autoreply define gpe_add_del_iface
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 is_add;
|
||||
u8 is_l2;
|
||||
bool is_add [default=true];
|
||||
bool is_l2;
|
||||
u32 dp_table;
|
||||
u32 vni;
|
||||
};
|
||||
@ -121,11 +120,8 @@ typedef gpe_fwd_entry
|
||||
{
|
||||
u32 fwd_entry_index;
|
||||
u32 dp_table;
|
||||
u8 eid_type;
|
||||
u8 leid_prefix_len;
|
||||
u8 reid_prefix_len;
|
||||
u8 leid[16];
|
||||
u8 reid[16];
|
||||
vl_api_eid_t leid;
|
||||
vl_api_eid_t reid;
|
||||
u32 vni;
|
||||
u8 action;
|
||||
};
|
||||
@ -161,7 +157,7 @@ autoreply define gpe_set_encap_mode
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 mode;
|
||||
bool is_vxlan;
|
||||
};
|
||||
|
||||
/** \brief get GPE encapsulation mode
|
||||
@ -184,6 +180,7 @@ define gpe_get_encap_mode_reply
|
||||
{
|
||||
u32 context;
|
||||
i32 retval;
|
||||
/* FIXME: gpe encap enum */
|
||||
u8 encap_mode;
|
||||
};
|
||||
|
||||
@ -200,11 +197,10 @@ autoreply define gpe_add_del_native_fwd_rpath
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 is_add;
|
||||
bool is_add [default=true];
|
||||
u32 table_id;
|
||||
u32 nh_sw_if_index;
|
||||
u8 is_ip4;
|
||||
u8 nh_addr[16];
|
||||
vl_api_interface_index_t nh_sw_if_index;
|
||||
vl_api_address_t nh_addr;
|
||||
};
|
||||
|
||||
/** \brief get GPE native fwd rpath
|
||||
@ -215,7 +211,7 @@ define gpe_native_fwd_rpaths_get
|
||||
{
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 is_ip4;
|
||||
bool is_ip4;
|
||||
};
|
||||
|
||||
/** \brief Reply for get native fwd rpath
|
||||
@ -228,9 +224,8 @@ define gpe_native_fwd_rpaths_get
|
||||
typedef gpe_native_fwd_rpath
|
||||
{
|
||||
u32 fib_index;
|
||||
u32 nh_sw_if_index;
|
||||
u8 is_ip4;
|
||||
u8 nh_addr[16];
|
||||
vl_api_interface_index_t nh_sw_if_index;
|
||||
vl_api_address_t nh_addr;
|
||||
};
|
||||
|
||||
manual_print manual_endian define gpe_native_fwd_rpaths_get_reply
|
||||
@ -246,4 +241,3 @@ manual_print manual_endian define gpe_native_fwd_rpaths_get_reply
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
|
||||
#include <vnet/fib/fib_table.h>
|
||||
#include <vnet/vnet_msg_enum.h>
|
||||
#include <vnet/ip/ip_types_api.h>
|
||||
#include <vnet/ethernet/ethernet_types_api.h>
|
||||
#include <vnet/lisp-gpe/lisp_types_api.h>
|
||||
|
||||
#define vl_api_gpe_locator_pair_t_endian vl_noop_handler
|
||||
#define vl_api_gpe_locator_pair_t_print vl_noop_handler
|
||||
@ -75,7 +78,7 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
|
||||
/* local locator */
|
||||
r = &((vl_api_gpe_locator_t *) locs)[i];
|
||||
clib_memset (&pair, 0, sizeof (pair));
|
||||
ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
|
||||
ip_address_decode2 (&r->addr, &pair.lcl_loc);
|
||||
|
||||
pair.weight = r->weight;
|
||||
vec_add1 (pairs, pair);
|
||||
@ -86,43 +89,11 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
|
||||
/* remote locators */
|
||||
r = &((vl_api_gpe_locator_t *) locs)[i];
|
||||
p = &pairs[i - rloc_num];
|
||||
ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? AF_IP4 : AF_IP6);
|
||||
ip_address_decode2 (&r->addr, &p->rmt_loc);
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
|
||||
static int
|
||||
unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
|
||||
u8 len)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0: /* ipv4 */
|
||||
gid_address_type (dst) = GID_ADDR_IP_PREFIX;
|
||||
gid_address_ip_set (dst, src, AF_IP4);
|
||||
gid_address_ippref_len (dst) = len;
|
||||
ip_prefix_normalize (&gid_address_ippref (dst));
|
||||
break;
|
||||
case 1: /* ipv6 */
|
||||
gid_address_type (dst) = GID_ADDR_IP_PREFIX;
|
||||
gid_address_ip_set (dst, src, AF_IP6);
|
||||
gid_address_ippref_len (dst) = len;
|
||||
ip_prefix_normalize (&gid_address_ippref (dst));
|
||||
break;
|
||||
case 2: /* l2 mac */
|
||||
gid_address_type (dst) = GID_ADDR_MAC;
|
||||
clib_memcpy (&gid_address_mac (dst), src, 6);
|
||||
break;
|
||||
default:
|
||||
/* unknown type */
|
||||
return VNET_API_ERROR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
gid_address_vni (dst) = vni;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gpe_fwd_entry_path_dump_t_net_to_host
|
||||
(vl_api_gpe_fwd_entry_path_dump_t * mp)
|
||||
@ -135,16 +106,7 @@ lisp_api_set_locator (vl_api_gpe_locator_t * loc,
|
||||
const ip_address_t * addr, u8 weight)
|
||||
{
|
||||
loc->weight = weight;
|
||||
if (AF_IP4 == ip_addr_version (addr))
|
||||
{
|
||||
loc->is_ip4 = 1;
|
||||
memcpy (loc->addr, addr, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
loc->is_ip4 = 0;
|
||||
memcpy (loc->addr, addr, 16);
|
||||
}
|
||||
ip_address_encode2 (addr, &loc->addr);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -208,25 +170,20 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
|
||||
switch (fid_addr_type (&e->leid))
|
||||
{
|
||||
case FID_ADDR_IP_PREF:
|
||||
if (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&e->leid)))
|
||||
{
|
||||
memcpy (&dst[i].leid, &fid_addr_ippref (&e->leid), 4);
|
||||
memcpy (&dst[i].reid, &fid_addr_ippref (&e->reid), 4);
|
||||
dst[i].eid_type = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (&dst[i].leid, &fid_addr_ippref (&e->leid), 16);
|
||||
memcpy (&dst[i].reid, &fid_addr_ippref (&e->reid), 16);
|
||||
dst[i].eid_type = 1;
|
||||
}
|
||||
dst[i].leid_prefix_len = ip_prefix_len (&fid_addr_ippref (&e->leid));
|
||||
dst[i].reid_prefix_len = ip_prefix_len (&fid_addr_ippref (&e->reid));
|
||||
dst[i].leid.type = EID_TYPE_API_PREFIX;
|
||||
dst[i].reid.type = EID_TYPE_API_PREFIX;
|
||||
ip_prefix_encode2 (&fid_addr_ippref (&e->leid),
|
||||
&dst[i].leid.address.prefix);
|
||||
ip_prefix_encode2 (&fid_addr_ippref (&e->reid),
|
||||
&dst[i].reid.address.prefix);
|
||||
break;
|
||||
case FID_ADDR_MAC:
|
||||
memcpy (&dst[i].leid, fid_addr_mac (&e->leid), 6);
|
||||
memcpy (&dst[i].reid, fid_addr_mac (&e->reid), 6);
|
||||
dst[i].eid_type = 2;
|
||||
mac_address_encode ((mac_address_t *) fid_addr_mac (&e->leid),
|
||||
dst[i].leid.address.mac);
|
||||
mac_address_encode ((mac_address_t *) fid_addr_mac (&e->reid),
|
||||
dst[i].reid.address.mac);
|
||||
dst[i].leid.type = EID_TYPE_API_MAC;
|
||||
dst[i].reid.type = EID_TYPE_API_MAC;
|
||||
break;
|
||||
default:
|
||||
clib_warning ("unknown fid type %d!", fid_addr_type (&e->leid));
|
||||
@ -334,10 +291,8 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp)
|
||||
gpe_add_del_fwd_entry_t_net_to_host (mp);
|
||||
clib_memset (a, 0, sizeof (a[0]));
|
||||
|
||||
rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type,
|
||||
mp->rmt_eid, mp->rmt_len);
|
||||
rv |= unformat_lisp_eid_api (&a->lcl_eid, mp->vni, mp->eid_type,
|
||||
mp->lcl_eid, mp->lcl_len);
|
||||
rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, &mp->rmt_eid);
|
||||
rv |= unformat_lisp_eid_api (&a->lcl_eid, mp->vni, &mp->lcl_eid);
|
||||
|
||||
if (mp->loc_num % 2 != 0)
|
||||
{
|
||||
@ -375,7 +330,7 @@ vl_api_gpe_enable_disable_t_handler (vl_api_gpe_enable_disable_t * mp)
|
||||
int rv = 0;
|
||||
vnet_lisp_gpe_enable_disable_args_t _a, *a = &_a;
|
||||
|
||||
a->is_en = mp->is_en;
|
||||
a->is_en = mp->is_enable;
|
||||
vnet_lisp_gpe_enable_disable (a);
|
||||
|
||||
REPLY_MACRO (VL_API_GPE_ENABLE_DISABLE_REPLY);
|
||||
@ -421,7 +376,7 @@ vl_api_gpe_set_encap_mode_t_handler (vl_api_gpe_set_encap_mode_t * mp)
|
||||
vl_api_gpe_set_encap_mode_reply_t *rmp;
|
||||
int rv = 0;
|
||||
|
||||
rv = vnet_gpe_set_encap_mode (mp->mode);
|
||||
rv = vnet_gpe_set_encap_mode (mp->is_vxlan);
|
||||
REPLY_MACRO (VL_API_GPE_SET_ENCAP_MODE_REPLY);
|
||||
}
|
||||
|
||||
@ -449,13 +404,15 @@ static void
|
||||
|
||||
clib_memset (a, 0, sizeof (a[0]));
|
||||
|
||||
if (mp->is_ip4)
|
||||
clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr, sizeof (ip4_address_t));
|
||||
if (mp->nh_addr.af)
|
||||
clib_memcpy (&a->rpath.frp_addr.ip6, mp->nh_addr.un.ip6,
|
||||
sizeof (ip6_address_t));
|
||||
else
|
||||
clib_memcpy (&a->rpath.frp_addr.ip6, mp->nh_addr, sizeof (ip6_address_t));
|
||||
clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr.un.ip4,
|
||||
sizeof (ip4_address_t));
|
||||
|
||||
a->is_add = mp->is_add;
|
||||
a->rpath.frp_proto = mp->is_ip4 ? DPO_PROTO_IP4 : DPO_PROTO_IP6;
|
||||
a->rpath.frp_proto = mp->nh_addr.af ? DPO_PROTO_IP6 : DPO_PROTO_IP4;
|
||||
a->rpath.frp_fib_index =
|
||||
fib_table_find (dpo_proto_to_fib (a->rpath.frp_proto),
|
||||
clib_net_to_host_u32 (mp->table_id));
|
||||
@ -475,7 +432,7 @@ done:
|
||||
|
||||
static void
|
||||
gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst,
|
||||
fib_route_path_t * src, u8 is_ip4)
|
||||
fib_route_path_t * src)
|
||||
{
|
||||
fib_route_path_t *e;
|
||||
fib_table_t *table;
|
||||
@ -487,11 +444,7 @@ gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst,
|
||||
table = fib_table_get (e->frp_fib_index, dpo_proto_to_fib (e->frp_proto));
|
||||
dst[i].fib_index = table->ft_table_id;
|
||||
dst[i].nh_sw_if_index = e->frp_sw_if_index;
|
||||
dst[i].is_ip4 = is_ip4;
|
||||
if (is_ip4)
|
||||
clib_memcpy (&dst[i].nh_addr, &e->frp_addr.ip4, sizeof (ip4_address_t));
|
||||
else
|
||||
clib_memcpy (&dst[i].nh_addr, &e->frp_addr.ip6, sizeof (ip6_address_t));
|
||||
ip_address_encode (&e->frp_addr, IP46_TYPE_ANY, &dst[i].nh_addr);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@ -527,7 +480,7 @@ vl_api_gpe_native_fwd_rpaths_get_t_handler (vl_api_gpe_native_fwd_rpaths_get_t
|
||||
u32 size = 0;
|
||||
int rv = 0;
|
||||
|
||||
u8 rpath_index = mp->is_ip4 ? 0 : 1;
|
||||
u8 rpath_index = mp->is_ip4 ? 1 : 0;
|
||||
|
||||
size = vec_len (lgm->native_fwd_rpath[rpath_index])
|
||||
* sizeof (vl_api_gpe_native_fwd_rpath_t);
|
||||
@ -537,8 +490,7 @@ vl_api_gpe_native_fwd_rpaths_get_t_handler (vl_api_gpe_native_fwd_rpaths_get_t
|
||||
{
|
||||
rmp->count = vec_len (lgm->native_fwd_rpath[rpath_index]);
|
||||
gpe_native_fwd_rpaths_copy (rmp->entries,
|
||||
lgm->native_fwd_rpath[rpath_index],
|
||||
mp->is_ip4);
|
||||
lgm->native_fwd_rpath[rpath_index]);
|
||||
gpe_native_fwd_rpaths_get_reply_t_host_to_net (rmp);
|
||||
});
|
||||
/* *INDENT-ON* */
|
||||
|
1
src/vnet/lisp-gpe/lisp_types_api.c
Symbolic link
1
src/vnet/lisp-gpe/lisp_types_api.c
Symbolic link
@ -0,0 +1 @@
|
||||
../lisp-cp/lisp_types_api.c
|
1
src/vnet/lisp-gpe/lisp_types_api.h
Symbolic link
1
src/vnet/lisp-gpe/lisp_types_api.h
Symbolic link
@ -0,0 +1 @@
|
||||
../lisp-cp/lisp_types_api.h
|
@ -2611,7 +2611,7 @@ static void *vl_api_lisp_enable_disable_t_print
|
||||
u8 *s;
|
||||
|
||||
s = format (0, "SCRIPT: lisp_enable_disable %s",
|
||||
mp->is_en ? "enable" : "disable");
|
||||
mp->is_enable ? "enable" : "disable");
|
||||
|
||||
FINISH;
|
||||
}
|
||||
@ -2678,13 +2678,11 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print
|
||||
s = format (s, "%s ", mp->is_add ? "add" : "del");
|
||||
s = format (s, "vni %d ", (mp->vni));
|
||||
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid,
|
||||
mp->eid_type, mp->eid, mp->eid_len);
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid, mp->deid);
|
||||
|
||||
if (mp->is_src_dst)
|
||||
{
|
||||
s = format (s, "seid %U ", format_lisp_flat_eid,
|
||||
mp->eid_type, mp->seid, mp->seid_len);
|
||||
s = format (s, "seid %U ", format_lisp_flat_eid, mp->seid);
|
||||
}
|
||||
rloc_num = (mp->rloc_num);
|
||||
|
||||
@ -2704,8 +2702,7 @@ static void *vl_api_lisp_add_del_adjacency_t_print
|
||||
s = format (s, "%s ", mp->is_add ? "add" : "del");
|
||||
s = format (s, "vni %d ", (mp->vni));
|
||||
s = format (s, "reid %U leid %U ",
|
||||
format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
|
||||
format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
|
||||
format_lisp_flat_eid, mp->reid, format_lisp_flat_eid, mp->leid);
|
||||
|
||||
FINISH;
|
||||
}
|
||||
@ -2751,14 +2748,13 @@ static void *vl_api_lisp_add_del_local_eid_t_print
|
||||
s = format (s, "del ");
|
||||
|
||||
s = format (s, "vni %d ", (mp->vni));
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
|
||||
mp->prefix_len);
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid);
|
||||
s = format (s, "locator-set %s ", mp->locator_set_name);
|
||||
if (*mp->key)
|
||||
if (mp->key.id)
|
||||
{
|
||||
u32 key_id = mp->key_id;
|
||||
u32 key_id = mp->key.id;
|
||||
s = format (s, "key-id %U", format_hmac_key_id, key_id);
|
||||
s = format (s, "secret-key %s", mp->key);
|
||||
s = format (s, "secret-key %s", mp->key.key);
|
||||
}
|
||||
FINISH;
|
||||
}
|
||||
@ -2783,10 +2779,10 @@ static void *vl_api_lisp_add_del_map_resolver_t_print
|
||||
if (!mp->is_add)
|
||||
s = format (s, "del ");
|
||||
|
||||
if (mp->is_ipv6)
|
||||
s = format (s, "%U ", format_ip6_address, mp->ip_address);
|
||||
if (mp->ip_address.af)
|
||||
s = format (s, "%U ", format_ip6_address, mp->ip_address.un.ip6);
|
||||
else
|
||||
s = format (s, "%U ", format_ip4_address, mp->ip_address);
|
||||
s = format (s, "%U ", format_ip4_address, mp->ip_address.un.ip4);
|
||||
|
||||
FINISH;
|
||||
}
|
||||
@ -2798,7 +2794,7 @@ static void *vl_api_gpe_enable_disable_t_print
|
||||
|
||||
s = format (0, "SCRIPT: gpe_enable_disable ");
|
||||
|
||||
s = format (s, "%s ", mp->is_en ? "enable" : "disable");
|
||||
s = format (s, "%s ", mp->is_enable ? "enable" : "disable");
|
||||
|
||||
FINISH;
|
||||
}
|
||||
@ -2870,16 +2866,7 @@ static void *vl_api_lisp_map_request_mode_t_print
|
||||
|
||||
s = format (0, "SCRIPT: lisp_map_request_mode ");
|
||||
|
||||
switch (mp->mode)
|
||||
{
|
||||
case 0:
|
||||
s = format (s, "dst-only");
|
||||
break;
|
||||
case 1:
|
||||
s = format (s, "src-dst");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
s = mp->is_src_dst ? format (s, "src-dst") : format (s, "dst-only");
|
||||
|
||||
FINISH;
|
||||
}
|
||||
@ -2894,8 +2881,7 @@ static void *vl_api_lisp_eid_table_dump_t_print
|
||||
if (mp->eid_set)
|
||||
{
|
||||
s = format (s, "vni %d ", (mp->vni));
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
|
||||
mp->eid, mp->prefix_length);
|
||||
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid);
|
||||
switch (mp->filter)
|
||||
{
|
||||
case 1:
|
||||
@ -2904,6 +2890,8 @@ static void *vl_api_lisp_eid_table_dump_t_print
|
||||
case 2:
|
||||
s = format (s, "remote ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
FINISH;
|
||||
@ -2915,7 +2903,7 @@ static void *vl_api_lisp_rloc_probe_enable_disable_t_print
|
||||
u8 *s;
|
||||
|
||||
s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
|
||||
if (mp->is_enabled)
|
||||
if (mp->is_enable)
|
||||
s = format (s, "enable");
|
||||
else
|
||||
s = format (s, "disable");
|
||||
@ -2929,7 +2917,7 @@ static void *vl_api_lisp_map_register_enable_disable_t_print
|
||||
u8 *s;
|
||||
|
||||
s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
|
||||
if (mp->is_enabled)
|
||||
if (mp->is_enable)
|
||||
s = format (s, "enable");
|
||||
else
|
||||
s = format (s, "disable");
|
||||
|
153
test/lisp.py
153
test/lisp.py
@ -1,4 +1,5 @@
|
||||
import socket
|
||||
from ipaddress import ip_network
|
||||
|
||||
from vpp_object import VppObject
|
||||
|
||||
@ -19,13 +20,13 @@ class VppLispLocatorSet(VppObject):
|
||||
return self._ls_name
|
||||
|
||||
def add_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_locator_set(ls_name=self._ls_name)
|
||||
self.test.vapi.lisp_add_del_locator_set(locator_set_name=self._ls_name)
|
||||
self._test.registry.register(self, self.test.logger)
|
||||
|
||||
def get_lisp_locator_sets_dump_entry(self):
|
||||
result = self.test.vapi.lisp_locator_set_dump()
|
||||
for ls in result:
|
||||
if ls.ls_name.strip(b'\x00') == self._ls_name:
|
||||
if ls.ls_name.strip('\x00') == self._ls_name:
|
||||
return ls
|
||||
return None
|
||||
|
||||
@ -33,7 +34,7 @@ class VppLispLocatorSet(VppObject):
|
||||
return self.get_lisp_locator_sets_dump_entry() is not None
|
||||
|
||||
def remove_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_locator_set(ls_name=self._ls_name,
|
||||
self.test.vapi.lisp_add_del_locator_set(locator_set_name=self._ls_name,
|
||||
is_add=0)
|
||||
|
||||
def object_id(self):
|
||||
@ -73,7 +74,7 @@ class VppLispLocator(VppObject):
|
||||
return self._weight
|
||||
|
||||
def add_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_locator(ls_name=self._ls_name,
|
||||
self.test.vapi.lisp_add_del_locator(locator_set_name=self._ls_name,
|
||||
sw_if_index=self._sw_if_index,
|
||||
priority=self._priority,
|
||||
weight=self._weight)
|
||||
@ -93,7 +94,7 @@ class VppLispLocator(VppObject):
|
||||
|
||||
def remove_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_locator(
|
||||
ls_name=self._ls_name, sw_if_index=self._sw_if_index,
|
||||
locator_set_name=self._ls_name, sw_if_index=self._sw_if_index,
|
||||
priority=self._priority, weight=self._weight, is_add=0)
|
||||
self._test.registry.register(self, self.test.logger)
|
||||
|
||||
@ -102,9 +103,9 @@ class VppLispLocator(VppObject):
|
||||
|
||||
|
||||
class LispEIDType(object):
|
||||
IP4 = 0
|
||||
IP6 = 1
|
||||
MAC = 2
|
||||
PREFIX = 0
|
||||
MAC = 1
|
||||
NSH = 2
|
||||
|
||||
|
||||
class LispKeyIdType(object):
|
||||
@ -117,35 +118,52 @@ class LispEID(object):
|
||||
""" Lisp endpoint identifier """
|
||||
def __init__(self, eid):
|
||||
self.eid = eid
|
||||
self._type = -1
|
||||
|
||||
# find out whether EID is ip4 prefix, ip6 prefix or MAC
|
||||
if self.eid.find("/") != -1:
|
||||
if self.eid.find(":") == -1:
|
||||
self.eid_type = LispEIDType.IP4
|
||||
self.data_length = 4
|
||||
else:
|
||||
self.eid_type = LispEIDType.IP6
|
||||
self.data_length = 16
|
||||
# find out whether EID is ip prefix, or MAC
|
||||
try:
|
||||
self.prefix = ip_network(self.eid)
|
||||
self._type = LispEIDType.PREFIX
|
||||
return
|
||||
except ValueError:
|
||||
if self.eid.count(":") == 5: # MAC address
|
||||
self.mac = self.eid
|
||||
self._type = LispEIDType.MAC
|
||||
return
|
||||
raise Exception('Unsupported EID format {!s}!'.format(eid))
|
||||
|
||||
self.eid_address = self.eid.split("/")[0]
|
||||
self.prefix_length = int(self.eid.split("/")[1])
|
||||
elif self.eid.count(":") == 5: # MAC address
|
||||
self.eid_type = LispEIDType.MAC
|
||||
self.eid_address = self.eid
|
||||
self.prefix_length = 0
|
||||
self.data_length = 6
|
||||
else:
|
||||
raise Exception('Unsupported EID format {!s}!'.format(eid))
|
||||
@property
|
||||
def eid_type(self):
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def address(self):
|
||||
if self.eid_type == LispEIDType.PREFIX:
|
||||
return self.prefix
|
||||
elif self.eid_type == LispEIDType.MAC:
|
||||
return self.mac
|
||||
elif self.eid_type == LispEIDType.NSH:
|
||||
return Exception('Unimplemented')
|
||||
|
||||
@property
|
||||
def packed(self):
|
||||
if self.eid_type == LispEIDType.IP4:
|
||||
return socket.inet_pton(socket.AF_INET, self.eid_address)
|
||||
elif self.eid_type == LispEIDType.IP6:
|
||||
return socket.inet_pton(socket.AF_INET6, self.eid_address)
|
||||
if self.eid_type == LispEIDType.PREFIX:
|
||||
return {"type": self._type, "address": {"prefix": self.prefix}}
|
||||
elif self.eid_type == LispEIDType.MAC:
|
||||
return {"type": self._type, "address": {"mac": self.mac}}
|
||||
elif self.eid_type == LispEIDType.NSH:
|
||||
return Exception('Unimplemented')
|
||||
raise Exception('Unknown EID type {!s}!'.format(self.eid_type))
|
||||
|
||||
|
||||
class LispKey(object):
|
||||
""" Lisp Key """
|
||||
def __init__(self, key_type, key):
|
||||
self._key_type = key_type
|
||||
self._key = key
|
||||
|
||||
@property
|
||||
def packed(self):
|
||||
return {"id": self._key_type, "key": self._key}
|
||||
|
||||
|
||||
class VppLispMapping(VppObject):
|
||||
@ -180,9 +198,7 @@ class VppLispMapping(VppObject):
|
||||
|
||||
def get_lisp_mapping_dump_entry(self):
|
||||
return self.test.vapi.lisp_eid_table_dump(
|
||||
eid_set=1, prefix_length=self._eid.prefix_length,
|
||||
vni=self._vni, eid_type=self._eid.eid_type,
|
||||
eid=self._eid.packed)
|
||||
eid_set=1, vni=self._vni, eid=self._eid.packed)
|
||||
|
||||
def query_vpp_config(self):
|
||||
mapping = self.get_lisp_mapping_dump_entry()
|
||||
@ -190,7 +206,7 @@ class VppLispMapping(VppObject):
|
||||
|
||||
def object_id(self):
|
||||
return 'lisp-mapping-[%s]-%s-%s-%s' % (
|
||||
self.vni, self.eid, self.priority, self.weight)
|
||||
self.vni, self.eid.address, self.priority, self.weight)
|
||||
|
||||
|
||||
class VppLocalMapping(VppLispMapping):
|
||||
@ -199,8 +215,7 @@ class VppLocalMapping(VppLispMapping):
|
||||
key_id=LispKeyIdType.NONE, key=''):
|
||||
super(VppLocalMapping, self).__init__(test, eid, vni, priority, weight)
|
||||
self._ls_name = ls_name
|
||||
self._key_id = key_id
|
||||
self._key = key
|
||||
self._key = LispKey(key_id, key)
|
||||
|
||||
@property
|
||||
def ls_name(self):
|
||||
@ -216,19 +231,29 @@ class VppLocalMapping(VppLispMapping):
|
||||
|
||||
def add_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_local_eid(
|
||||
ls_name=self._ls_name, eid_type=self._eid.eid_type,
|
||||
eid=self._eid.packed, prefix_len=self._eid.prefix_length,
|
||||
vni=self._vni, key_id=self._key_id, key=self._key)
|
||||
locator_set_name=self._ls_name, eid=self._eid.packed,
|
||||
vni=self._vni, key=self._key.packed)
|
||||
self._test.registry.register(self, self.test.logger)
|
||||
|
||||
def remove_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_local_eid(
|
||||
ls_name=self._ls_name, eid_type=self._eid.eid_type,
|
||||
eid=self._eid.packed, prefix_len=self._eid.prefix_length,
|
||||
locator_set_name=self._ls_name, eid=self._eid.packed,
|
||||
vni=self._vni, is_add=0)
|
||||
|
||||
def object_id(self):
|
||||
return 'lisp-eid-local-mapping-%s[%d]' % (self._eid, self._vni)
|
||||
return 'lisp-eid-local-mapping-%s[%d]' % (self._eid.address, self._vni)
|
||||
|
||||
|
||||
class LispRemoteLocator(object):
|
||||
def __init__(self, addr, priority=1, weight=1):
|
||||
self.addr = addr
|
||||
self.priority = priority
|
||||
self.weight = weight
|
||||
|
||||
@property
|
||||
def packed(self):
|
||||
return {"priority": self.priority, "weight": self.weight,
|
||||
"ip_address": self.addr}
|
||||
|
||||
|
||||
class VppRemoteMapping(VppLispMapping):
|
||||
@ -240,23 +265,24 @@ class VppRemoteMapping(VppLispMapping):
|
||||
|
||||
@property
|
||||
def rlocs(self):
|
||||
return self._rlocs
|
||||
rlocs = []
|
||||
for rloc in self._rlocs:
|
||||
rlocs.append(rloc.packed)
|
||||
return rlocs
|
||||
|
||||
def add_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_remote_mapping(
|
||||
rlocs=self._rlocs, eid_type=self._eid.eid_type,
|
||||
eid=self._eid.packed, eid_prefix_len=self._eid.prefix_length,
|
||||
vni=self._vni, rlocs_num=len(self._rlocs))
|
||||
rlocs=self.rlocs, deid=self._eid.packed,
|
||||
vni=self._vni, rloc_num=len(self._rlocs))
|
||||
self._test.registry.register(self, self.test.logger)
|
||||
|
||||
def remove_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_remote_mapping(
|
||||
eid_type=self._eid.eid_type, eid=self._eid.packed,
|
||||
eid_prefix_len=self._eid.prefix_length, vni=self._vni,
|
||||
is_add=0, rlocs_num=0)
|
||||
deid=self._eid.packed, vni=self._vni, is_add=0, rloc_num=0)
|
||||
|
||||
def object_id(self):
|
||||
return 'lisp-eid-remote-mapping-%s[%d]' % (self._eid, self._vni)
|
||||
return 'lisp-eid-remote-mapping-%s[%d]' % (self._eid.address,
|
||||
self._vni)
|
||||
|
||||
|
||||
class VppLispAdjacency(VppObject):
|
||||
@ -288,22 +314,19 @@ class VppLispAdjacency(VppObject):
|
||||
|
||||
def add_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_adjacency(
|
||||
leid=self._leid.packed,
|
||||
reid=self._reid.packed, eid_type=self._leid.eid_type,
|
||||
leid_len=self._leid.prefix_length,
|
||||
reid_len=self._reid.prefix_length, vni=self._vni)
|
||||
leid=self._leid.packed, reid=self._reid.packed, vni=self._vni)
|
||||
self._test.registry.register(self, self.test.logger)
|
||||
|
||||
@staticmethod
|
||||
def eid_equal(eid, eid_type, eid_data, prefix_len):
|
||||
if eid.eid_type != eid_type:
|
||||
def eid_equal(eid, eid_api):
|
||||
if eid.eid_type != eid_api.type:
|
||||
return False
|
||||
|
||||
if eid_type == LispEIDType.IP4 or eid_type == LispEIDType.IP6:
|
||||
if eid.prefix_length != prefix_len:
|
||||
if eid_api.type == LispEIDType.PREFIX:
|
||||
if eid.address.prefixlen != eid_api.address.prefix.prefixlen:
|
||||
return False
|
||||
|
||||
if eid.packed != eid_data[0:eid.data_length]:
|
||||
if eid.address != eid_api.address:
|
||||
return False
|
||||
|
||||
return True
|
||||
@ -311,19 +334,15 @@ class VppLispAdjacency(VppObject):
|
||||
def query_vpp_config(self):
|
||||
res = self.test.vapi.lisp_adjacencies_get(vni=self._vni)
|
||||
for adj in res.adjacencies:
|
||||
if self.eid_equal(self._leid, adj.eid_type, adj.leid,
|
||||
adj.leid_prefix_len) and \
|
||||
self.eid_equal(self._reid, adj.eid_type, adj.reid,
|
||||
adj.reid_prefix_len):
|
||||
if self.eid_equal(self._leid, adj.leid) and \
|
||||
self.eid_equal(self._reid, adj.reid):
|
||||
return True
|
||||
return False
|
||||
|
||||
def remove_vpp_config(self):
|
||||
self.test.vapi.lisp_add_del_adjacency(
|
||||
leid=self._leid.packed,
|
||||
reid=self._reid.packed, eid_type=self._leid.eid_type,
|
||||
leid_len=self._leid.prefix_length,
|
||||
reid_len=self._reid.prefix_length, vni=self._vni, is_add=0)
|
||||
leid=self._leid.packed, reid=self._reid.packed,
|
||||
vni=self._vni, is_add=0)
|
||||
|
||||
def object_id(self):
|
||||
return 'lisp-adjacency-%s-%s[%d]' % (self._leid, self._reid, self._vni)
|
||||
|
@ -11,7 +11,7 @@ from scapy.layers.inet6 import IPv6
|
||||
|
||||
from framework import VppTestCase, VppTestRunner
|
||||
from lisp import VppLocalMapping, VppLispAdjacency, VppLispLocator, \
|
||||
VppLispLocatorSet, VppRemoteMapping
|
||||
VppLispLocatorSet, VppRemoteMapping, LispRemoteLocator
|
||||
from util import ppp, ForeignAddressFactory
|
||||
|
||||
# From py_lispnetworking.lisp.py: # GNU General Public License v2.0
|
||||
@ -151,7 +151,7 @@ class TestLisp(VppTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestLisp, self).setUp()
|
||||
self.vapi.lisp_enable_disable(is_enabled=1)
|
||||
self.vapi.lisp_enable_disable(is_enable=1)
|
||||
|
||||
def test_lisp_basic_encap(self):
|
||||
"""Test case for basic encapsulation"""
|
||||
@ -159,26 +159,21 @@ class TestLisp(VppTestCase):
|
||||
self.deid_ip4_net = self.faf.net
|
||||
self.deid_ip4 = self.faf.get_ip4()
|
||||
self.seid_ip4 = '{!s}/{!s}'.format(self.pg0.local_ip4, 32)
|
||||
self.rloc_ip4 = self.pg1.remote_ip4n
|
||||
self.rloc_ip4 = self.pg1.remote_ip4
|
||||
|
||||
test_cases = [
|
||||
{
|
||||
'name': 'basic ip4 over ip4',
|
||||
'locator-sets': [VppLispLocatorSet(self, b'ls-4o4')],
|
||||
'locator-sets': [VppLispLocatorSet(self, 'ls-4o4')],
|
||||
'locators': [
|
||||
VppLispLocator(self, self.pg1.sw_if_index, b'ls-4o4')
|
||||
VppLispLocator(self, self.pg1.sw_if_index, 'ls-4o4')
|
||||
],
|
||||
'local-mappings': [
|
||||
VppLocalMapping(self, self.seid_ip4, b'ls-4o4')
|
||||
VppLocalMapping(self, self.seid_ip4, 'ls-4o4')
|
||||
],
|
||||
'remote-mappings': [
|
||||
VppRemoteMapping(self, self.deid_ip4_net,
|
||||
[{
|
||||
"is_ip4": 1,
|
||||
"priority": 1,
|
||||
"weight": 1,
|
||||
"addr": self.rloc_ip4
|
||||
}])
|
||||
[LispRemoteLocator(self.rloc_ip4)])
|
||||
],
|
||||
'adjacencies': [
|
||||
VppLispAdjacency(self, self.seid_ip4, self.deid_ip4_net)
|
||||
|
@ -711,130 +711,6 @@ class VppPapiProvider(object):
|
||||
'is_ip6': is_ip6
|
||||
}})
|
||||
|
||||
def lisp_enable_disable(self, is_enabled):
|
||||
return self.api(
|
||||
self.papi.lisp_enable_disable,
|
||||
{
|
||||
'is_en': is_enabled,
|
||||
})
|
||||
|
||||
def lisp_add_del_locator_set(self,
|
||||
ls_name,
|
||||
is_add=1):
|
||||
return self.api(
|
||||
self.papi.lisp_add_del_locator_set,
|
||||
{
|
||||
'is_add': is_add,
|
||||
'locator_set_name': ls_name
|
||||
})
|
||||
|
||||
def lisp_add_del_locator(self,
|
||||
ls_name,
|
||||
sw_if_index,
|
||||
priority=1,
|
||||
weight=1,
|
||||
is_add=1):
|
||||
return self.api(
|
||||
self.papi.lisp_add_del_locator,
|
||||
{
|
||||
'is_add': is_add,
|
||||
'locator_set_name': ls_name,
|
||||
'sw_if_index': sw_if_index,
|
||||
'priority': priority,
|
||||
'weight': weight
|
||||
})
|
||||
|
||||
def lisp_locator_dump(self, is_index_set, ls_name=None, ls_index=0):
|
||||
return self.api(
|
||||
self.papi.lisp_locator_dump,
|
||||
{
|
||||
'is_index_set': is_index_set,
|
||||
'ls_name': ls_name,
|
||||
'ls_index': ls_index,
|
||||
})
|
||||
|
||||
def lisp_add_del_local_eid(self,
|
||||
ls_name,
|
||||
eid_type,
|
||||
eid,
|
||||
prefix_len,
|
||||
vni=0,
|
||||
key_id=0,
|
||||
key="",
|
||||
is_add=1):
|
||||
return self.api(
|
||||
self.papi.lisp_add_del_local_eid,
|
||||
{
|
||||
'locator_set_name': ls_name,
|
||||
'is_add': is_add,
|
||||
'eid_type': eid_type,
|
||||
'eid': eid,
|
||||
'prefix_len': prefix_len,
|
||||
'vni': vni,
|
||||
'key_id': key_id,
|
||||
'key': key
|
||||
})
|
||||
|
||||
def lisp_eid_table_dump(self,
|
||||
eid_set=0,
|
||||
prefix_length=0,
|
||||
vni=0,
|
||||
eid_type=0,
|
||||
eid=None,
|
||||
filter_opt=0):
|
||||
return self.api(
|
||||
self.papi.lisp_eid_table_dump,
|
||||
{
|
||||
'eid_set': eid_set,
|
||||
'prefix_length': prefix_length,
|
||||
'vni': vni,
|
||||
'eid_type': eid_type,
|
||||
'eid': eid,
|
||||
'filter': filter_opt,
|
||||
})
|
||||
|
||||
def lisp_add_del_remote_mapping(self,
|
||||
eid_type,
|
||||
eid,
|
||||
eid_prefix_len=0,
|
||||
vni=0,
|
||||
rlocs=[],
|
||||
rlocs_num=0,
|
||||
is_src_dst=0,
|
||||
is_add=1):
|
||||
return self.api(
|
||||
self.papi.lisp_add_del_remote_mapping,
|
||||
{
|
||||
'is_add': is_add,
|
||||
'eid_type': eid_type,
|
||||
'eid': eid,
|
||||
'eid_len': eid_prefix_len,
|
||||
'rloc_num': rlocs_num,
|
||||
'rlocs': rlocs,
|
||||
'vni': vni,
|
||||
'is_src_dst': is_src_dst,
|
||||
})
|
||||
|
||||
def lisp_add_del_adjacency(self,
|
||||
leid,
|
||||
reid,
|
||||
leid_len,
|
||||
reid_len,
|
||||
eid_type,
|
||||
is_add=1,
|
||||
vni=0):
|
||||
return self.api(
|
||||
self.papi.lisp_add_del_adjacency,
|
||||
{
|
||||
'is_add': is_add,
|
||||
'vni': vni,
|
||||
'eid_type': eid_type,
|
||||
'leid': leid,
|
||||
'reid': reid,
|
||||
'leid_len': leid_len,
|
||||
'reid_len': reid_len,
|
||||
})
|
||||
|
||||
def vxlan_gpe_add_del_tunnel(
|
||||
self,
|
||||
src_addr,
|
||||
|
Reference in New Issue
Block a user