diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-06-02 16:07:38 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2016-06-23 13:00:39 +0000 |
commit | 324112fad06e0461958f22827f944595466e1891 (patch) | |
tree | 4b1f19473e7fcd17e41d98d8165a338067c4fb62 /vpp | |
parent | 0443212371ec7cb68be297ed06ad1c3a39d23713 (diff) |
LISP EID virtualization support
Change-Id: I892c001cfdff9d8d93e646641d96520beb3c6265
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/api/api.c | 47 | ||||
-rw-r--r-- | vpp/api/vpe.api | 46 |
2 files changed, 88 insertions, 5 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c index 9a5935a8..54545cc0 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -334,10 +334,12 @@ _(LISP_ENABLE_DISABLE, lisp_enable_disable) \ _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \ _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \ _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \ +_(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \ _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \ _(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump) \ _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \ _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \ +_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \ _(LISP_ENABLE_DISABLE_STATUS_DUMP, \ lisp_enable_disable_status_dump) \ _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \ @@ -4770,6 +4772,7 @@ vl_api_lisp_add_del_local_eid_t_handler( u32 locator_set_index = ~0, map_index = ~0; vnet_lisp_add_del_mapping_args_t _a, *a = &_a; u8 *name = NULL; + memset (a, 0, sizeof (a[0])); prefp = &gid_address_ippref(&eid); ip_eid = &ip_prefix_addr(prefp); @@ -4796,19 +4799,31 @@ vl_api_lisp_add_del_local_eid_t_handler( /* XXX treat batch configuration */ a->is_add = mp->is_add; + gid_address_vni (&eid) = clib_net_to_host_u32 (mp->vni); a->deid = eid; a->locator_set_index = locator_set_index; a->local = 1; - rv = vnet_lisp_add_del_local_mapping(a, &map_index); out: vec_free(name); + gid_address_free (&a->deid); REPLY_MACRO(VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY); } static void +vl_api_lisp_eid_table_add_del_map_t_handler( + vl_api_lisp_eid_table_add_del_map_t *mp) +{ + vl_api_lisp_eid_table_add_del_map_reply_t *rmp; + int rv = 0; + rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni), + clib_net_to_host_u32 (mp->vrf), mp->is_add); + REPLY_MACRO(VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY) +} + +static void lisp_gpe_add_del_fwd_entry_set_address( vl_api_lisp_gpe_add_del_fwd_entry_t *mp, ip_address_t *slocator, @@ -5019,8 +5034,8 @@ vl_api_lisp_add_del_remote_mapping_t_handler ( ip_address_t * deid_addr = &ip_prefix_addr(deid_pref); ip_prefix_len(seid_pref) = mp->seid_len; ip_prefix_len(deid_pref) = mp->deid_len; - gid_address_set_vni (seid, ntohl (mp->vni)); - gid_address_set_vni (deid, ntohl (mp->vni)); + gid_address_vni (seid) = ntohl (mp->vni); + gid_address_vni (deid) = ntohl (mp->vni); if (mp->eid_is_ip4) { ip_prefix_version(seid_pref) = IP4; @@ -5172,7 +5187,7 @@ send_lisp_local_eid_table_details (mapping_t *mapit, } rmp->eid_prefix_len = ip_prefix_len(ip_prefix); rmp->context = context; - + rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid)); vl_msg_api_send_shmem (q, (u8 *)&rmp); } @@ -5229,7 +5244,7 @@ send_lisp_gpe_tunnel_details (lisp_gpe_tunnel_t *tunnel, static void vl_api_lisp_gpe_tunnel_dump_t_handler ( - vl_api_lisp_local_eid_table_dump_t *mp) + vl_api_lisp_gpe_tunnel_dump_t *mp) { unix_shared_memory_queue_t * q = NULL; lisp_gpe_main_t * lgm = &lisp_gpe_main; @@ -5300,6 +5315,28 @@ vl_api_lisp_map_resolver_dump_t_handler ( } static void +vl_api_lisp_eid_table_map_dump_t_handler ( + vl_api_lisp_eid_table_map_dump_t *mp) +{ + unix_shared_memory_queue_t * q = NULL; + lisp_cp_main_t * lcm = vnet_lisp_cp_get_main(); + hash_pair_t * p; + + q = vl_api_client_index_to_input_queue (mp->client_index); + if (q == 0) { + return; + } + hash_foreach_pair (p, lcm->table_id_by_vni, { + vl_api_lisp_eid_table_map_details_t * rmp = NULL; + memset (rmp, 0, sizeof (*rmp)); + rmp->_vl_msg_id = ntohs(VL_API_LISP_EID_TABLE_MAP_DETAILS); + rmp->vni = p->key; + rmp->vrf = p->value[0]; + rmp->context = mp->context; + }); +} + +static void send_lisp_enable_disable_details (unix_shared_memory_queue_t *q, u32 context) { diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index 14664fdb..28cba3d7 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -2205,6 +2205,7 @@ define lisp_add_del_locator_reply { @param ip_address - array of address bytes @param prefix_len - prefix len @param locator_set_name - name of locator_set to add/del eid-table + @param vni - vitual network instance */ define lisp_add_del_local_eid { u32 client_index; @@ -2214,6 +2215,7 @@ define lisp_add_del_local_eid { u8 ip_address[16]; u8 prefix_len; u8 locator_set_name[64]; + u32 vni; }; /** \brief Reply for local_eid add/del @@ -2427,6 +2429,30 @@ define lisp_add_del_map_request_itr_rlocs_reply { i32 retval; }; +/** \brief map/unmap vni to vrf + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param is_add - add or delete mapping + @param vni - virtual network id + @param vrf - vrf +*/ +define lisp_eid_table_add_del_map { + u32 client_index; + u32 context; + u8 is_add; + u32 vni; + u32 vrf; +}; + +/** \brief Reply for lisp_eid_table_add_del_map + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ +define lisp_eid_table_add_del_map_reply { + u32 context; + i32 retval; +}; + /** \brief LISP locator_set status @param locator_set_name - name of the locator_set @param sw_if_index - sw_if_index of the locator @@ -2464,6 +2490,7 @@ manual_java define lisp_local_eid_table_details { u32 context; u8 locator_set_name[64]; u8 eid_is_ipv6; + u32 vni; u8 eid_ip_address[16]; u8 eid_prefix_len; }; @@ -2477,6 +2504,25 @@ define lisp_local_eid_table_dump { u32 context; }; +/** \brief Shows relationship between vni and vrf + @param vrf - VRF index + @param vni - vitual network instance + */ +manual_java define lisp_eid_table_map_details { + u32 context; + u32 vni; + u32 vrf; +}; + +/** \brief Request for lisp_eid_table_map_details + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + */ +define lisp_eid_table_map_dump { + u32 client_index; + u32 context; +}; + manual_java define lisp_gpe_tunnel_details { u32 context; u32 tunnels; |