+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* BGP Peer Attribute Unit Tests
* Copyright (C) 2018 Pascal Mathis
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
enum test_peer_attr_type type;
union {
- uint32_t flag;
+ uint64_t flag;
struct {
- uint32_t flag;
+ uint64_t flag;
size_t direct;
} filter;
} u;
.o.invert_peer = true,
.o.use_iface_peer = true,
},
+ {
+ .cmd = "capability software-version",
+ .u.flag = PEER_FLAG_CAPABILITY_SOFT_VERSION,
+ .type = PEER_AT_GLOBAL_FLAG,
+ },
+ {
+ .cmd = "capability software-version",
+ .u.flag = PEER_FLAG_CAPABILITY_SOFT_VERSION,
+ .type = PEER_AT_GLOBAL_FLAG,
+ .o.invert_peer = true,
+ .o.use_iface_peer = true,
+ },
{
.cmd = "description",
.peer_cmd = "description FRR Peer",
return "ipv4";
case AFI_IP6:
return "ipv6";
- default:
- return "<unknown AFI>";
+ case AFI_L2VPN:
+ return "l2vpn";
+ case AFI_MAX:
+ case AFI_UNSPEC:
+ return "bad-value";
}
-}
-static const char *str_from_safi(safi_t safi)
-{
- switch (safi) {
- case SAFI_UNICAST:
- return "unicast";
- case SAFI_MULTICAST:
- return "multicast";
- default:
- return "<unknown SAFI>";
- }
+ assert(!"Reached end of function we should never reach");
}
static const char *str_from_attr_type(enum test_peer_attr_type at)
test_log(test, "prepare: switch address-family to [%s]",
get_afi_safi_str(pa->afi, pa->safi, false));
test_execute(test, "address-family %s %s",
- str_from_afi(pa->afi), str_from_safi(pa->safi));
+ str_from_afi(pa->afi), safi2str(pa->safi));
test_execute(test, "neighbor %s activate", g->name);
test_execute(test, "neighbor %s activate", p->host);
}
test_log(test, "prepare: switch address-family to [%s]",
get_afi_safi_str(pa->afi, pa->safi, false));
test_execute(test, "address-family %s %s",
- str_from_afi(pa->afi), str_from_safi(pa->safi));
+ str_from_afi(pa->afi), safi2str(pa->safi));
test_execute(test, "neighbor %s activate", g->name);
test_execute(test, "neighbor %s activate", p->host);
}
test_log(test, "prepare: switch address-family to [%s]",
get_afi_safi_str(pa->afi, pa->safi, false));
test_execute(test, "address-family %s %s",
- str_from_afi(pa->afi), str_from_safi(pa->safi));
+ str_from_afi(pa->afi), safi2str(pa->safi));
test_execute(test, "neighbor %s activate", g->name);
test_execute(test, "neighbor %s activate", p->host);
}
if (pa->afi && pa->safi)
desc = asprintfrr(MTYPE_TMP, "peer\\%s-%s\\%s",
str_from_afi(pa->afi),
- str_from_safi(pa->safi), pa->cmd);
+ safi2str(pa->safi), pa->cmd);
else
desc = asprintfrr(MTYPE_TMP, "peer\\%s", pa->cmd);