use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole in project bgpcep by opendaylight.
the class AbstractAddPathTest method configurePeer.
protected static BGPPeer configurePeer(final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry) {
final IpAddress ipAddress = new IpAddress(peerAddress);
final BGPPeer bgpPeer = new BGPPeer(new IpAddress(peerAddress), ribImpl, peerRole, null, AFI_SAFIS_ADVERTIZED, Collections.emptySet());
final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
bgpPeerRegistry.addPeer(ipAddress, bgpPeer, new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(RIB_ID), AS_NUMBER, tlvs));
bgpPeer.instantiateServiceInstance();
return bgpPeer;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method toPeerRole.
@Test
public void toPeerRole() {
Neighbor neighbor = new NeighborBuilder().setConfig(new ConfigBuilder().setPeerType(PeerType.EXTERNAL).build()).build();
PeerRole peerRoleResult = OpenConfigMappingUtil.toPeerRole(neighbor);
Assert.assertEquals(PeerRole.Ebgp, peerRoleResult);
neighbor = new NeighborBuilder().setConfig(new ConfigBuilder().setPeerType(PeerType.INTERNAL).build()).build();
peerRoleResult = OpenConfigMappingUtil.toPeerRole(neighbor);
Assert.assertEquals(PeerRole.Ibgp, peerRoleResult);
neighbor = new NeighborBuilder().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.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole in project bgpcep by opendaylight.
the class MatchRoleSetHandler method loadRoleSets.
private List<PeerRole> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
final ReadOnlyTransaction tr = this.dataBroker.newReadOnlyTransaction();
final Optional<RoleSet> result = tr.read(LogicalDatastoreType.CONFIGURATION, ROLE_SET_IID.child(RoleSet.class, new RoleSetKey(key))).get();
if (!result.isPresent()) {
return Collections.emptyList();
}
return result.get().getRole();
}
Aggregations