aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api-test
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2016-07-10 20:09:32 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2016-07-11 23:02:43 +0000
commit71893ac8b765dd997452fc58aedb6e0bd7b79a25 (patch)
tree5cbc8afaeec4333e556cfb0b93543181c699b961 /vpp-api-test
parentefc33309594bc1e13dd30534b7658191c2abbca7 (diff)
Simplify API to add LISP adjacencies
The API to add an adjacency requires that two things be provided 1) a local and a remote eid 2) the whole remote mapping for the remote eid. Since the API to add remote mappings can be used for 2), 1) in combination with this API are enough to add an adjacency. Change-Id: Ibe7474924bc3f28b6aed19cefa78fdb812de5eac Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'vpp-api-test')
-rw-r--r--vpp-api-test/vat/api_format.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index dd428966550..a911e8a0e77 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -10790,15 +10790,13 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
vl_api_lisp_add_del_adjacency_t *mp;
f64 timeout = ~0;
u32 vni = 0;
- ip4_address_t seid4, deid4, rloc4;
- ip6_address_t seid6, deid6, rloc6;
+ ip4_address_t seid4, deid4;
+ ip6_address_t seid6, deid6;
u8 deid_mac[6] = {0};
u8 seid_mac[6] = {0};
u8 deid_type, seid_type;
u32 seid_len = 0, deid_len = 0, len;
u8 is_add = 1;
- u32 action = ~0, p, w;
- rloc_t * rlocs = 0, rloc, * curr_rloc = 0;
seid_type = deid_type = (u8)~0;
@@ -10832,25 +10830,6 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
seid_type = 2; /* mac */
} else if (unformat(input, "vni %d", &vni)) {
;
- } else if (unformat(input, "p %d w %d", &p, &w)) {
- if (!curr_rloc) {
- errmsg ("No RLOC configured for setting priority/weight!");
- return -99;
- }
- curr_rloc->priority = p;
- curr_rloc->weight = w;
- } else if (unformat(input, "rloc %U", unformat_ip4_address, &rloc4)) {
- rloc.is_ip4 = 1;
- clib_memcpy (&rloc.addr, &rloc4, sizeof (rloc4));
- vec_add1 (rlocs, rloc);
- curr_rloc = &rlocs[vec_len (rlocs) - 1];
- } else if (unformat(input, "rloc %U", unformat_ip6_address, &rloc6)) {
- rloc.is_ip4 = 0;
- clib_memcpy (&rloc.addr, &rloc6, sizeof (rloc6));
- vec_add1 (rlocs, rloc);
- curr_rloc = &rlocs[vec_len (rlocs) - 1];
- } else if (unformat(input, "action %d", &action)) {
- ;
} else {
errmsg ("parse error '%U'", format_unformat_error, input);
return -99;
@@ -10867,17 +10846,10 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
return -99;
}
- if (is_add && (~0 == action)
- && 0 == vec_len (rlocs)) {
- errmsg ("no action set for negative map-reply!");
- return -99;
- }
-
M(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency);
mp->is_add = is_add;
mp->vni = htonl (vni);
mp->seid_len = seid_len;
- mp->action = (u8) action;
mp->deid_len = deid_len;
mp->eid_type = deid_type;
@@ -10899,10 +10871,6 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
return 0;
}
- mp->rloc_num = vec_len (rlocs);
- clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
- vec_free (rlocs);
-
/* send it... */
S;
an class="cm"> * 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. */ /* * ip/ip_format.c: ip generic (4 or 6) formatting * * Copyright (c) 2008 Eliot Dresselhaus * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <vnet/ip/ip.h> /* Format IP protocol. */ u8 * format_ip_protocol (u8 * s, va_list * args) { ip_protocol_t protocol = va_arg (*args, ip_protocol_t); ip_main_t *im = &ip_main; ip_protocol_info_t *pi = ip_get_protocol_info (im, protocol); if (pi) return format (s, "%s", pi->name); else return format (s, "unknown %d", protocol); } uword unformat_ip_protocol (unformat_input_t * input, va_list * args) { u8 *result = va_arg (*args, u8 *); ip_main_t *im = &ip_main; ip_protocol_info_t *pi; int i; if (!unformat_user (input, unformat_vlib_number_by_name, im->protocol_info_by_name, &i)) return 0; pi = vec_elt_at_index (im->protocol_infos, i); *result = pi->protocol; return 1; } u8 * format_tcp_udp_port (u8 * s, va_list * args) { int port = va_arg (*args, int); ip_main_t *im = &ip_main; tcp_udp_port_info_t *pi; pi = ip_get_tcp_udp_port_info (im, port); if (pi) s = format (s, "%s", pi->name); else s = format (s, "%d", clib_net_to_host_u16 (port)); return s; } uword unformat_tcp_udp_port (unformat_input_t * input, va_list * args) { u16 *result = va_arg (*args, u16 *); ip_main_t *im = &ip_main; tcp_udp_port_info_t *pi; u32 i, port; if (unformat_user (input, unformat_vlib_number_by_name, im->port_info_by_name, &i)) { pi = vec_elt_at_index (im->port_infos, i); port = pi->port; } else if (unformat_user (input, unformat_vlib_number, &port) && port < (1 << 16)) port = clib_host_to_net_u16 (port); else return 0; *result = port; return 1; } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */