use of org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.TcpSecurityOption 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.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.TcpSecurityOption in project netvirt by opendaylight.
the class BgpConfigurationManager method extractMd5Secret.
private static String extractMd5Secret(final Neighbors val) {
String md5Secret = null;
TcpSecurityOption tcpSecOpt = val.getTcpSecurityOption();
if (tcpSecOpt != null) {
if (tcpSecOpt instanceof TcpMd5SignatureOption) {
md5Secret = ((TcpMd5SignatureOption) tcpSecOpt).getTcpMd5SignaturePassword().getValue();
} else {
// unknown TcpSecurityOption
LOG.debug("neighbors Ignored unknown tcp-security-option of peer {}", val.getAddress().getValue());
}
}
return md5Secret;
}
Aggregations