"md5-channel-factory" attribute set and then add a "password" attribute here.
Note that the peer has to have the same password configured, otherwise the
connection will not be established.
+ If peer role is not present, default value "Ibgp" will be used (allowed values are also "Ebgp" and
+ "RrClient").
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer</type>
<name>example-bgp-peer</name>
<host>192.0.2.1</host>
<holdtimer>180</holdtimer>
+ <peerRole>Ibgp<peerRole>
<rib>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:cfg">prefix:rib</type>
<name>example-bgp-rib</name>
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.MultiprotocolCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.graceful.restart._case.GracefulRestartCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.multiprotocol._case.MultiprotocolCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final List<BgpParameters> tlvs = getTlvs(r);
final AsNumber remoteAs = getAsOrDefault(r);
final String password = getPasswordOrNull();
-
final BGPSessionPreferences prefs = new BGPSessionPreferences(r.getLocalAs(), getHoldtimer(), r.getBgpIdentifier(), tlvs);
- final BGPPeer bgpClientPeer = new BGPPeer(peerName(getHostWithoutValue()), r);
+ final BGPPeer bgpClientPeer;
+ if (getPeerRole() != null) {
+ bgpClientPeer = new BGPPeer(peerName(getHostWithoutValue()), r, getPeerRole());
+ } else {
+ bgpClientPeer = new BGPPeer(peerName(getHostWithoutValue()), r, PeerRole.Ibgp);
+ }
+
bgpClientPeer.registerRootRuntimeBean(getRootRuntimeBeanRegistratorWrapper());
getPeerRegistryBackwards().addPeer(getHostWithoutValue(), bgpClientPeer, prefs);
private long sessionEstablishedCounter = 0L;
public BGPPeer(final String name, final RIB rib) {
+ this(name, rib, PeerRole.Ibgp);
+ }
+
+ public BGPPeer(final String name, final RIB rib, final PeerRole role) {
this.rib = Preconditions.checkNotNull(rib);
this.name = name;
this.chain = rib.createPeerChain(this);
-
- // FIXME: make this configurable
- final PeerRole role = PeerRole.Ibgp;
- this.ribWriter = AdjRibInWriter.create(rib.getYangRibId(), role, this.chain);
+ this.ribWriter = AdjRibInWriter.create(rib.getYangRibId(), role, chain);
}
@Override
default 180;
}
+ leaf peer-role {
+ type rib:peer-role;
+ default ibgp;
+ }
+
leaf initiate-connection {
description "If true, connection will be initiated right away from current device.
If not, the peer will only be registered to peer registry and available for incomming bgp connections.";