Search in sources :

Example 1 with NeighborsBuilder

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);
}
Also used : TcpSecurityOption(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.TcpSecurityOption) TcpMd5SignatureOptionBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOptionBuilder) NeighborsBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.NeighborsBuilder) Neighbors(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.Neighbors) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) Bgp(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp) NeighborsKey(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.NeighborsKey) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 2 with NeighborsBuilder

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();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) NeighborsBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder) ProtocolKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.ProtocolKey) BgpBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.BgpBuilder) Bgp(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp) BGP(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.BGP) NetworkInstanceProtocol(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NetworkInstanceProtocol)

Aggregations

WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 Bgp (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp)1 BgpBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.BgpBuilder)1 NeighborsBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder)1 ProtocolKey (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.ProtocolKey)1 BGP (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.BGP)1 Bgp (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp)1 Neighbors (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.Neighbors)1 NeighborsBuilder (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.NeighborsBuilder)1 NeighborsKey (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.NeighborsKey)1 TcpSecurityOption (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.TcpSecurityOption)1 TcpMd5SignatureOptionBuilder (org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOptionBuilder)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 NetworkInstanceProtocol (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NetworkInstanceProtocol)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1