use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder in project netvirt by opendaylight.
the class BgpConfigurationManager method addNeighbor.
public void addNeighbor(String nbrIp, long remoteAs, @Nullable final TcpMd5SignaturePasswordType md5Secret) {
Ipv4Address nbrAddr = new Ipv4Address(nbrIp);
InstanceIdentifier.InstanceIdentifierBuilder<Neighbors> iib = InstanceIdentifier.builder(Bgp.class).child(Neighbors.class, new NeighborsKey(nbrAddr));
InstanceIdentifier<Neighbors> iid = iib.build();
TcpSecurityOption tcpSecOption = null;
if (md5Secret != null) {
tcpSecOption = new TcpMd5SignatureOptionBuilder().setTcpMd5SignaturePassword(md5Secret).build();
}
// else let tcpSecOption be null
Neighbors dto = new NeighborsBuilder().setAddress(nbrAddr).setRemoteAs(remoteAs).setTcpSecurityOption(tcpSecOption).build();
update(iid, dto);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder in project bgpcep by opendaylight.
the class BGPOperationalStateUtilsTest method createDefaultProtocol.
private void createDefaultProtocol() throws ExecutionException, InterruptedException {
final WriteTransaction wt = getDataBroker().newWriteOnlyTransaction();
final Bgp bgp = new BgpBuilder().setGlobal(GlobalStateCliUtilsTest.buildGlobal(true).build()).setNeighbors(new NeighborsBuilder().setNeighbor(Collections.singletonList(NeighborStateCliUtilsTest.createBasicNeighbor())).build()).build();
GlobalStateCliUtilsTest.buildGlobal(true);
final InstanceIdentifier<Bgp> bgpIID = PROTOCOLS_IID.child(Protocol.class, new ProtocolKey(BGP.class, RIB_ID)).augmentation(NetworkInstanceProtocol.class).child(Bgp.class);
wt.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, true);
wt.submit().get();
}
Aggregations