Skip to content

Commit

Permalink
CumulusNclu: be robust to bad interface neighbor
Browse files Browse the repository at this point in the history
We used to crash
  • Loading branch information
dhalperi committed Dec 2, 2020
1 parent 2653a3e commit e4582ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ public void enterBn_interface(Bn_interfaceContext ctx) {
String.format(
"Cannot create BGP neighbor for illegal abstract interface name '%s' in: %s",
_currentBgpNeighborName, getFullText(ctx)));
_currentBgpNeighbor = new BgpPeerGroupNeighbor("dummy");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ public void testBgpPeerGroup() throws IOException {
assertThat(i3, hasRemoteAs(17L));
}

@Test
public void testBgpInvalidInterfaceNeighbor() throws IOException {
CumulusNcluConfiguration c = parseVendorConfig("cumulus_nclu_bgp_invalid_interface_neighbor");
assertThat(c.getBgpProcess().getDefaultVrf().getNeighbors(), anEmptyMap());
}

@Test
public void testBgpIpNeighbor() throws IOException {
Configuration c = parseConfig("cumulus_nclu_bgp_ip_neighbor");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
net del all
#
net add hostname cumulus_nclu_bgp_invalid_interface_neighbor
#
net add bgp autonomous-system 65500
net add bgp neighbor NOT_AN_IFACE_NAME interface remote-as 5
#
net commit

0 comments on commit e4582ea

Please sign in to comment.