Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zebra run once #4154

Merged
merged 7 commits into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ struct nexthop {
#define NEXTHOP_FLAG_RECURSIVE (1 << 2) /* Recursive nexthop. */
#define NEXTHOP_FLAG_ONLINK (1 << 3) /* Nexthop should be installed onlink. */
#define NEXTHOP_FLAG_MATCHED (1 << 4) /* Already matched vs a nexthop */
#define NEXTHOP_FLAG_FILTERED (1 << 5) /* rmap filtered, used by static only */
#define NEXTHOP_FLAG_DUPLICATE (1 << 6) /* nexthop duplicates another active one */
#define NEXTHOP_FLAG_DUPLICATE (1 << 5) /* nexthop duplicates another active one */
#define NEXTHOP_IS_ACTIVE(flags) \
(CHECK_FLAG(flags, NEXTHOP_FLAG_ACTIVE) \
&& !CHECK_FLAG(flags, NEXTHOP_FLAG_DUPLICATE))
Expand Down
24 changes: 24 additions & 0 deletions lib/nexthop_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ nexthop_group_cmd_compare(const struct nexthop_group_cmd *nhgc1,
return strcmp(nhgc1->name, nhgc2->name);
}

uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
{
struct nexthop *nhop;
uint8_t num = 0;

for (ALL_NEXTHOPS_PTR(nhg, nhop))
num++;

return num;
}

uint8_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg)
{
struct nexthop *nhop;
uint8_t num = 0;

for (ALL_NEXTHOPS_PTR(nhg, nhop)) {
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
num++;
}

return num;
}

struct nexthop *nexthop_exists(struct nexthop_group *nhg, struct nexthop *nh)
{
struct nexthop *nexthop;
Expand Down
5 changes: 5 additions & 0 deletions lib/nexthop_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ extern struct nexthop_group_cmd *nhgc_find(const char *name);

extern void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh);

/* Return the number of nexthops in this nhg */
extern uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg);
extern uint8_t
nexthop_group_active_nexthop_num(const struct nexthop_group *nhg);

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from lutil import luCommand
luCommand('ce1','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up',180)
luCommand('ce2','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up')
luCommand('ce3','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up')
luCommand('ce2','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up',180)
luCommand('ce3','vtysh -c "show bgp summary"',' 00:0','wait','Adjacencies up',180)
luCommand('ce4','vtysh -c "show bgp vrf all summary"',' 00:0','wait','Adjacencies up',180)
luCommand('r1','ping 2.2.2.2 -c 1',' 0. packet loss','wait','PE->P2 (loopback) ping',60)
luCommand('r3','ping 2.2.2.2 -c 1',' 0. packet loss','wait','PE->P2 (loopback) ping',60)
Expand Down
Loading