use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetNeighborKey.
@Test
public void testGetNeighborKey() {
assertArrayEquals(MD5_PASSWORD.getBytes(StandardCharsets.US_ASCII), OpenConfigMappingUtil.getNeighborKey(NEIGHBOR).asMap().get(INSTANCE.inetAddressFor(NEIGHBOR_ADDRESS)));
assertNull(OpenConfigMappingUtil.getNeighborKey(EMPTY_NEIGHBOR));
assertNull(OpenConfigMappingUtil.getNeighborKey(new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setConfig(new ConfigBuilder().build()).build()));
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method toPeerRole.
@Test
public void toPeerRole() {
Neighbor neighbor = new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setConfig(new ConfigBuilder().setPeerType(PeerType.EXTERNAL).build()).build();
PeerRole peerRoleResult = OpenConfigMappingUtil.toPeerRole(neighbor);
Assert.assertEquals(PeerRole.Ebgp, peerRoleResult);
neighbor = new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setConfig(new ConfigBuilder().setPeerType(PeerType.INTERNAL).build()).build();
peerRoleResult = OpenConfigMappingUtil.toPeerRole(neighbor);
Assert.assertEquals(PeerRole.Ibgp, peerRoleResult);
neighbor = new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setRouteReflector(new RouteReflectorBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.route.reflector.ConfigBuilder().setRouteReflectorClient(true).build()).build()).build();
peerRoleResult = OpenConfigMappingUtil.toPeerRole(neighbor);
Assert.assertEquals(PeerRole.RrClient, peerRoleResult);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method isAppNeighbor.
@Test
public void isAppNeighbor() {
assertFalse(OpenConfigMappingUtil.isApplicationPeer(new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setConfig(new ConfigBuilder().build()).build()));
final Neighbor neighbor = new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setConfig(new ConfigBuilder().addAugmentation(new NeighborPeerGroupConfigBuilder().setPeerGroup(OpenConfigMappingUtil.APPLICATION_PEER_GROUP_NAME).build()).build()).build();
assertTrue(OpenConfigMappingUtil.isApplicationPeer(neighbor));
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetNeighborClusterIdentifier.
@Test
public void testGetNeighborClusterIdentifier() {
assertNull(OpenConfigMappingUtil.getNeighborClusterIdentifier(null, null));
final PeerGroupBuilder peerGroup = new PeerGroupBuilder().setPeerGroupName("foo");
assertNull(OpenConfigMappingUtil.getNeighborClusterIdentifier(null, peerGroup.build()));
final RouteReflectorBuilder configBuilder = new RouteReflectorBuilder();
assertNull(OpenConfigMappingUtil.getNeighborClusterIdentifier(configBuilder.build(), peerGroup.build()));
configBuilder.setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.route.reflector.ConfigBuilder().setRouteReflectorClusterId(new RrClusterIdType(CLUSTER_ID)).build()).build();
assertEquals(CLUSTER_ID.getValue(), OpenConfigMappingUtil.getNeighborClusterIdentifier(configBuilder.build(), peerGroup.build()).getValue());
assertEquals(CLUSTER_ID.getValue(), OpenConfigMappingUtil.getNeighborClusterIdentifier(null, peerGroup.setRouteReflector(configBuilder.build()).build()).getValue());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetLocalPeerAs.
@Test
public void testGetLocalPeerAs() {
final ConfigBuilder configBuilder = new ConfigBuilder();
assertEquals(GLOBAL_AS, OpenConfigMappingUtil.getLocalPeerAs(null, GLOBAL_AS));
assertEquals(AS, OpenConfigMappingUtil.getLocalPeerAs(configBuilder.setLocalAs(AS).build(), GLOBAL_AS));
}
Aggregations