+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import static java.util.Objects.requireNonNull;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.SendReceive;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.add.path.capability.AddressFamilies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-public final class AddPathImplModule extends AbstractAddPathImplModule {
- public AddPathImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public AddPathImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.bgp.rib.impl.AddPathImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- JmxAttributeValidationException.checkNotNull(getSendReceive(), "value is not set.", sendReceiveJmxAttribute);
- JmxAttributeValidationException.checkNotNull(getAddressFamily(), "value is not set.", addressFamilyJmxAttribute);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new AutoCloseableAddPath(getAddressFamilyDependency(), getSendReceive());
- }
-
- private static final class AutoCloseableAddPath implements AutoCloseable, AddressFamilies {
- private final BgpTableType family;
- private final SendReceive sendReceiveMode;
-
- public AutoCloseableAddPath(final BgpTableType addressFamilyDependency, final SendReceive sendReceive) {
- this.family = requireNonNull(addressFamilyDependency);
- this.sendReceiveMode = requireNonNull(sendReceive);
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("AutoCloseableAddPath [family=");
- builder.append(this.family.toString());
- builder.append(", sendReceiveMode=");
- builder.append(this.sendReceiveMode);
- builder.append("]");
- return builder.toString();
- }
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return AddressFamilies.class;
- }
-
- @Override
- public void close() throws Exception {
- }
-
- @Override
- public <E extends Augmentation<AddressFamilies>> E getAugmentation(final Class<E> arg0) {
- return null;
- }
-
- @Override
- public Class<? extends AddressFamily> getAfi() {
- return this.family.getAfi();
- }
-
- @Override
- public Class<? extends SubsequentAddressFamily> getSafi() {
- return this.family.getSafi();
- }
-
- @Override
- public SendReceive getSendReceive() {
- return this.sendReceiveMode;
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-public class AddPathImplModuleFactory extends AbstractAddPathImplModuleFactory {
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BgpDeployer;
-import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborKey;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.ProtocolKey;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.BGP;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Protocol1;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.osgi.framework.BundleContext;
-
-/**
- * Application peer handler which handles translation from custom RIB into local RIB
- */
-@Deprecated
-public class BGPApplicationPeerModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPApplicationPeerModule {
-
- private BundleContext bundleContext;
-
- public BGPApplicationPeerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public BGPApplicationPeerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.bgp.rib.impl.BGPApplicationPeerModule oldModule, final java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- final RIB rib = getTargetRibDependency();
- final WaitingServiceTracker<BgpDeployer> bgpDeployerTracker = WaitingServiceTracker.create(BgpDeployer.class, this.bundleContext);
- final BgpDeployer bgpDeployer = bgpDeployerTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
- //map configuration to OpenConfig BGP
- final Neighbor neighbor = OpenConfigMappingUtil.fromApplicationPeer(getApplicationRibId(), getBgpPeerId());
- //write to configuration DS
- final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = bgpDeployer.getInstanceIdentifier().child(Protocols.class)
- .child(Protocol.class, new ProtocolKey(BGP.class, rib.getInstanceIdentifier().getKey().getId().getValue()));
- final InstanceIdentifier<Bgp> bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class);
- final KeyedInstanceIdentifier<Neighbor, NeighborKey> neighborIId = protocolIId.augmentation(Protocol1.class).child(Bgp.class)
- .child(Neighbors.class).child(Neighbor.class, neighbor.getKey());
- bgpDeployer.onNeighborModified(bgpIID, neighbor, () -> bgpDeployer.writeConfiguration(neighbor, neighborIId));
-
- return () -> {
- bgpDeployer.onNeighborRemoved(bgpIID, neighbor);
- bgpDeployerTracker.close();
- };
- }
-
- public void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
-
-@Deprecated
-public class BGPApplicationPeerModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPApplicationPeerModuleFactory {
-
- @Override
- public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
- final BGPApplicationPeerModule module = (BGPApplicationPeerModule) super.createModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
- final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
- final BGPApplicationPeerModule module = (BGPApplicationPeerModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-dispatcher-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:02:32 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import com.google.common.reflect.AbstractInvocationHandler;
-import com.google.common.reflect.Reflection;
-import java.lang.reflect.Method;
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
- * of the provided config system service are converted to blueprint.
- */
-@Deprecated
-public final class BGPDispatcherImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPDispatcherImplModule {
- private BundleContext bundleContext;
-
- public BGPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(name, dependencyResolver);
- }
-
- public BGPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BGPDispatcherImplModule oldModule,
- final java.lang.AutoCloseable oldInstance) {
- super(name, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public AutoCloseable createInstance() {
- // The BGPDispatcher instance is created and advertised as an OSGi service via blueprint
- // so obtain it here (waiting if necessary).
- final WaitingServiceTracker<BGPDispatcher> tracker =
- WaitingServiceTracker.create(BGPDispatcher.class, this.bundleContext);
- final BGPDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
- // Create a proxy to override close to close the ServiceTracker. The actual BGPDispatcher
- // instance will be closed via blueprint.
- return Reflection.newProxy(AutoCloseableBGPDispatcher.class, new AbstractInvocationHandler() {
- @Override
- protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if (method.getName().equals("close")) {
- tracker.close();
- return null;
- }
-
- return method.invoke(service, args);
- }
- });
- }
-
- void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- private interface AutoCloseableBGPDispatcher extends BGPDispatcher, AutoCloseable {
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-dispatcher-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:02:32 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
- * of the provided config system service are converted to blueprint.
- */
-@Deprecated
-public class BGPDispatcherImplModuleFactory extends AbstractBGPDispatcherImplModuleFactory {
- @Override
- public BGPDispatcherImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
- BGPDispatcherImplModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
- BGPDispatcherImplModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
- oldInstance, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public BGPDispatcherImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
- BundleContext bundleContext) {
- BGPDispatcherImplModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import static java.util.Objects.requireNonNull;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-public final class BGPPSMImplModule extends AbstractBGPPSMImplModule {
- public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public BGPPSMImplModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, BGPPSMImplModule oldModule, AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- private static final class AutoCloseableBestPathSelectionStrategy implements BGPBestPathSelection {
-
- private final BgpTableType pathFamilyDependency;
- private final PathSelectionMode strategyFactory;
-
- AutoCloseableBestPathSelectionStrategy(final BgpTableType pathFamilyDependency, final PathSelectionMode strategyFactory) {
- this.pathFamilyDependency = requireNonNull(pathFamilyDependency);
- this.strategyFactory = requireNonNull(strategyFactory);
- }
-
- @Override
- public void close() throws Exception {
- this.strategyFactory.close();
- }
-
- @Override
- public Class<? extends AddressFamily> getAfi() {
- return this.pathFamilyDependency.getAfi();
- }
-
- @Override
- public Class<? extends SubsequentAddressFamily> getSafi() {
- return this.pathFamilyDependency.getSafi();
- }
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return BGPBestPathSelection.class;
- }
-
- @Override
- public PathSelectionMode getStrategy() {
- return this.strategyFactory;
- }
- }
-
- @Override
- public void customValidation() {
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new AutoCloseableBestPathSelectionStrategy(getPathAddressFamilyDependency(), getPathSelectionModeDependency());
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-public class BGPPSMImplModuleFactory extends AbstractBGPPSMImplModuleFactory {
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2013, 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-peer
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Sat Jan 25 11:00:14 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import com.google.common.reflect.AbstractInvocationHandler;
-import com.google.common.reflect.Reflection;
-import io.netty.channel.epoll.Epoll;
-import java.lang.reflect.Method;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BgpDeployer;
-import org.opendaylight.protocol.bgp.rib.impl.spi.InstanceType;
-import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
-import org.opendaylight.protocol.util.Ipv4Util;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborKey;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.ProtocolKey;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.BGP;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Protocol1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.osgi.framework.BundleContext;
-
-/**
- *
- */
-@Deprecated
-public final class BGPPeerModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPPeerModule {
-
- private BundleContext bundleContext;
-
- public BGPPeerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public BGPPeerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BGPPeerModule oldModule,
- final java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- protected void customValidation() {
- final IpAddress host = getHost();
- JmxAttributeValidationException.checkNotNull(host, "value is not set.", hostJmxAttribute);
- JmxAttributeValidationException.checkCondition(host.getIpv4Address() != null || host.getIpv6Address() != null,
- "Unexpected host", hostJmxAttribute);
-
- JmxAttributeValidationException.checkNotNull(getPort(), "value is not set.", portJmxAttribute);
-
- if (getPeerRole() != null) {
- final boolean isNotPeerRoleInternal= getPeerRole() != PeerRole.Internal;
- JmxAttributeValidationException.checkCondition(isNotPeerRoleInternal,
- "Internal Peer Role is reserved for Application Peer use.", peerRoleJmxAttribute);
- }
-
- if (isPasswordPresent(getPassword())) {
- JmxAttributeValidationException.checkCondition(Epoll.isAvailable(),
- "BGP Peer is configured with password but native transport is not available", passwordJmxAttribute);
- }
-
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- final RIB rib = getRibDependency();
- final WaitingServiceTracker<BgpDeployer> bgpDeployerTracker = WaitingServiceTracker.create(BgpDeployer.class, this.bundleContext);
- final BgpDeployer bgpDeployer = bgpDeployerTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
- //map configuration to OpenConfig BGP
- final Neighbor neighbor = OpenConfigMappingUtil.fromBgpPeer(getAddPathDependency(), getAdvertizedTableDependency(), getHoldtimer(),
- getHost(), getInitiateConnection(), getPassword(), getPort(), getRetrytimer(), getRemoteAs(), getPeerRole(), getSimpleRoutingPolicy(),
- bgpDeployer.getTableTypeRegistry());
- //write to configuration DS
- final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = bgpDeployer.getInstanceIdentifier().child(Protocols.class)
- .child(Protocol.class, new ProtocolKey(BGP.class, rib.getInstanceIdentifier().getKey().getId().getValue()));
- final InstanceIdentifier<Bgp> bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class);
- final KeyedInstanceIdentifier<Neighbor, NeighborKey> neighborIId = protocolIId.augmentation(Protocol1.class).child(Bgp.class)
- .child(Neighbors.class).child(Neighbor.class, neighbor.getKey());
- bgpDeployer.onNeighborModified(bgpIID, neighbor, () -> bgpDeployer.writeConfiguration(neighbor, neighborIId));
- //get rib instance service, use filter
- final WaitingServiceTracker<BGPPeerRuntimeMXBean> peerTracker = WaitingServiceTracker.create(BGPPeerRuntimeMXBean.class,
- this.bundleContext, "(" + InstanceType.PEER.getBeanName() + "=" + Ipv4Util.toStringIP(getHost()) + ")");
- final BGPPeerRuntimeMXBean peer = peerTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
- final BGPPeerRuntimeRegistration runtimeRegistration = getRootRuntimeBeanRegistratorWrapper().register(peer);
- return Reflection.newProxy(AutoCloseablePeer.class, new AbstractInvocationHandler() {
- @Override
- protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if (method.getName().equals("close")) {
- bgpDeployer.onNeighborRemoved(bgpIID, neighbor);
- runtimeRegistration.close();
- bgpDeployerTracker.close();
- peerTracker.close();
- return null;
- }
-
- return method.invoke(peer, args);
- }
- });
- }
-
- private static boolean isPasswordPresent(final Rfc2385Key password) {
- return password != null && ! password.getValue().isEmpty();
- }
-
- public void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- private interface AutoCloseablePeer extends RIB, AutoCloseable {
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-peer
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Sat Jan 25 11:00:14 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
-
-/**
- *
- */
-@Deprecated
-public class BGPPeerModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPPeerModuleFactory {
-
- @Override
- public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
- final BGPPeerModule module = (BGPPeerModule) super.createModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
- final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
- final BGPPeerModule module = (BGPPeerModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-table-type-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Sat Jan 25 20:28:03 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import static java.util.Objects.requireNonNull;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-
-/**
- *
- */
-public final class BGPTableTypeImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPTableTypeImplModule {
-
- public BGPTableTypeImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public BGPTableTypeImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BGPTableTypeImplModule oldModule,
- final java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- protected void customValidation() {
- JmxAttributeValidationException.checkNotNull(getAfi(), "value is not set.", afiJmxAttribute);
- JmxAttributeValidationException.checkNotNull(getSafi(), "value is not set.", safiJmxAttribute);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new AutoCloseableBgpTableType(getAfiIdentity(), getSafiIdentity());
- }
-
- private static final class AutoCloseableBgpTableType implements AutoCloseable, BgpTableType {
- private final Class<? extends AddressFamily> afi;
- private final Class<? extends SubsequentAddressFamily> safi;
-
- public AutoCloseableBgpTableType(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
- this.afi = requireNonNull(afi);
- this.safi = requireNonNull(safi);
- }
-
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return BgpTableType.class;
- }
-
- @Override
- public Class<? extends AddressFamily> getAfi() {
- return this.afi;
- }
-
- @Override
- public Class<? extends SubsequentAddressFamily> getSafi() {
- return this.safi;
- }
-
- @Override
- public void close() {
- // Nothing to do
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("AutoCloseableBgpTableType [getAfi()=");
- builder.append(getAfi());
- builder.append(", getSafi()=");
- builder.append(getSafi());
- builder.append("]");
- return builder.toString();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-rib-impl yang module local name: bgp-table-type-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Sat Jan 25 20:28:03 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-/**
-*
-*/
-public class BGPTableTypeImplModuleFactory extends
- org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPTableTypeImplModuleFactory {
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
- * <p>
- * Generated from: yang module name: bgp-rib-impl yang module local name: rib-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:02:32 CET 2013
- * <p>
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-/**
- *
- */
-@Deprecated
-public final class RIBImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModule {
-
- public RIBImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(name, dependencyResolver);
- }
-
- public RIBImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBImplModule oldModule,
- final java.lang.AutoCloseable oldInstance) {
- super(name, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- //NOP
- return null;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
- * <p>
- * Generated from: yang module name: bgp-rib-impl yang module local name: rib-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:02:32 CET 2013
- * <p>
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-/**
- *
- */
-@Deprecated
-public class RIBImplModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModuleFactory {
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import com.google.common.reflect.AbstractInvocationHandler;
-import com.google.common.reflect.Reflection;
-import java.lang.reflect.Method;
-import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
-import org.osgi.framework.BundleContext;
-
-/**
- * Registry of BGP peers that allows only one connection per 2 peers
- *
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class StrictBgpPeerRegistryModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractStrictBgpPeerRegistryModule {
- private BundleContext bundleContext;
-
- public StrictBgpPeerRegistryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public StrictBgpPeerRegistryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.bgp.rib.impl.StrictBgpPeerRegistryModule oldModule, final java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- final WaitingServiceTracker<BGPPeerRegistry> tracker =
- WaitingServiceTracker.create(BGPPeerRegistry.class, this.bundleContext);
- final BGPPeerRegistry service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
- return Reflection.newProxy(BGPPeerRegistry.class, new AbstractInvocationHandler() {
- @Override
- protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if (method.getName().equals("close")) {
- tracker.close();
- return null;
- }
-
- return method.invoke(service, args);
- }
- });
- }
-
- void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class StrictBgpPeerRegistryModuleFactory extends AbstractStrictBgpPeerRegistryModuleFactory {
- @Override
- public StrictBgpPeerRegistryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
- StrictBgpPeerRegistryModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
- StrictBgpPeerRegistryModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
- oldInstance, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public StrictBgpPeerRegistryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
- BundleContext bundleContext) {
- StrictBgpPeerRegistryModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-}
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
-import org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerRuntimeRegistration;
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
private final RIB rib;
private final String name;
- private BGPPeerRuntimeRegistration runtimeReg;
private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap<>();
private final RpcProviderRegistry rpcRegistry;
private RoutedRpcRegistration<BgpPeerRpcService> rpcRegistration;
}
closeRegistration();
final ListenableFuture<Void> future = cleanup();
- dropConnection();
- resetState();
- return future;
- }
-
- private void closeRegistration() {
- for (final AbstractRegistration tableCloseable : this.tableRegistration) {
- tableCloseable.close();
- }
- this.tableRegistration.clear();
- }
- private void dropConnection() {
- if (this.runtimeReg != null) {
- this.runtimeReg.close();
- this.runtimeReg = null;
- }
if (this.session != null) {
try {
this.session.close();
}
this.session = null;
}
+
+ resetState();
+ return future;
+ }
+
+ private void closeRegistration() {
+ this.tableRegistration.iterator().forEachRemaining(AbstractRegistration::close);
+ this.tableRegistration.clear();
}
@Override
+++ /dev/null
-module bgp-peer {
- namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:peer:config";
- prefix "bgp-peer";
-
- import bgp-rib { prefix rib; revision-date 2013-09-25; }
- import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
- import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
- import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
- import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
- import rfc2385 { prefix rfc2385; revision-date 2016-03-24; }
-
- organization "Brocade Communications Systems, Inc.";
- contact "Kevin Wang <kwang@brocade.com>";
-
- description
- "This module contains the base data model of BGP peer.
-
- Copyright (c) 2016 Brocade Communications Systems, Inc. All rights reserved.
-
- This program and the accompanying materials are made available
- under the terms of the Eclipse Public License v1.0 which
- accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html";
-
- revision 2016-06-06 {
- description "Initial revision";
- }
-
- grouping bgp-peer-config-attributes {
- leaf host {
- description "Host IP address of BGP connection";
- type inet:ip-address;
- mandatory true;
- }
-
- leaf port {
- description "The port for connection between the BGP peers.";
- type inet:port-number;
- default 179;
- }
-
- leaf holdtimer {
- description "Time interval (in seconds) for HoldTimer proposed by the peer.";
- type uint16;
- default 180;
- }
- }
-
- grouping bgp-peer-config {
- uses bgp-peer-config-attributes;
-
- leaf retrytimer {
- type uint16;
- default 10;
- }
-
- leaf peer-role {
- type rib:peer-role;
- default ibgp;
- }
-
- leaf simple-routing-policy {
- type rib:simple-routing-policy;
- }
-
- 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.";
- type boolean;
- default true;
- }
-
- leaf route-refresh {
- type boolean;
- default "true";
- }
-
- leaf remote-as {
- description
- "Expected remote AS number. If not present, it is assumed
- to be the same as our local AS number.";
- type inet:as-number;
- }
-
- leaf password {
- type rfc2385:rfc2385-key;
- description "RFC2385 shared secret";
- }
- }
-
- grouping bgp-peer-preferences {
- leaf bgp-id {
- description "The BGP Identifier.";
- type bgp-t:bgp-id;
- }
-
- uses bgp-peer-config-attributes;
-
- leaf as {
- description "Autonomous system number.";
- type inet:as-number;
- default 0;
- }
-
- leaf four-octet-as-capability {
- description "The BGP peer 4 byte AS numbers support capability.";
- type boolean;
- default "false";
- }
-
- leaf bgp-extended-message-capability {
- description "The bgp extended message support capability.";
- type boolean;
- default "false";
- }
-
- leaf gr-capability {
- description "BGP graceful restart support capability.";
- type boolean;
- default "false";
- }
-
- leaf route-refresh-capability {
- reference "https://tools.ietf.org/html/rfc2918";
- type boolean;
- default "false";
- }
-
- list advertized-table-types {
- description "The BGP Table-type capabilities advertized by the BGP peer.";
- key "afi safi";
- uses bgp-mp:bgp-table-type;
- }
-
- list advertised-add-path-table-types {
- description "The BGP Table-type capabilities advertized by the BGP peer.";
- key "afi safi";
- uses bgp-mp:bgp-add-path-table-type;
- }
- }
-}
+++ /dev/null
-module bgp-rib-impl {
- namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl:config";
- prefix "bgp-rib-impl";
-
- import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
- import bgp-rib { prefix rib; revision-date 2013-09-25; }
- import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
- import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
-
- organization "Brocade Communications Systems, Inc.";
- contact "Kevin Wang <kwang@brocade.com>";
-
- description
- "This module contains the base data model of BGP RIB implementation.
-
- Copyright (c) 2016 Brocade Communications Systems, Inc. All rights reserved.
-
- This program and the accompanying materials are made available
- under the terms of the Eclipse Public License v1.0 which
- accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html";
-
- revision 2016-06-06 {
- description "Initial revision";
- }
-
- grouping bgp-rib-impl-identifiers {
- leaf local-as {
- description "Our local AS number. Needed by best selection path attribute.";
- type inet:as-number;
- mandatory true;
- }
-
- leaf bgp-rib-id {
- description "Our local BGP identifier. Needed by best selection path attribute.";
- mandatory true;
- type bgp-t:bgp-id;
- }
-
- leaf rib-id {
- description "Identifier of this RIB in local data store.";
- type rib:rib-id;
- mandatory true;
- }
-
- leaf cluster-id {
- description "IBGP identifier. Needed by route reflection.";
- reference "https://tools.ietf.org/html/rfc4456#section-7";
- type bgp-t:cluster-identifier;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// vi: set smarttab et sw=4 tabstop=4:
-module odl-bgp-rib-impl-cfg {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl";
- prefix "bgprib-impl";
-
- import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
- import bgp-rib { prefix rib; revision-date 2013-09-25; }
- import bgp-rib-impl { prefix bgp-rib-impl; revision-date 2016-06-06; }
- import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
- import odl-bgp-rib-cfg { prefix bgprib; revision-date 2013-07-01; }
- import odl-bgp-rib-spi-cfg { prefix ribspi; revision-date 2013-11-15; }
- import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
- import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
- import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
- import opendaylight-md-sal-dom {prefix sal; revision-date 2013-10-28; }
- import opendaylight-md-sal-binding-v1-codec { prefix mdsb1; revision-date 2016-07-14; }
- import netty { prefix netty; revision-date 2013-11-19; }
- import config { prefix config; revision-date 2013-04-05; }
- import rpc-context { prefix rpcx; revision-date 2013-06-17; }
- import odl-bgp-path-selection-mode { prefix bps; revision-date 2016-03-01;}
- import bgp-peer { prefix peer; revision-date 2016-06-06; }
-
- organization "Cisco Systems, Inc.";
-
- contact "Robert Varga <rovarga@cisco.com>";
-
- description
- "This module contains the base YANG definitions for
- BGP listener implementation.
-
- Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
-
- This program and the accompanying materials are made available
- under the terms of the Eclipse Public License v1.0 which
- accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html";
-
- revision "2016-03-30" {
- description
- "Updated to simplify reconnection strategy.";
- }
- revision "2013-04-09" {
- description
- "Initial revision";
- }
-
- identity bgp-dispatcher {
- description
- "Service representing a BGP Dispatcher.";
-
- base "config:service-type";
- config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher";
- config:disable-osgi-service-registration;
- }
-
- identity bgp-dispatcher-impl {
- base config:module-type;
- config:provided-service bgp-dispatcher;
- config:java-name-prefix BGPDispatcherImpl;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-dispatcher-impl {
- when "/config:modules/config:module/config:type = 'bgp-dispatcher-impl'";
- }
- }
-
- identity rib-instance {
- description
- "Service representing a RIB instance";
-
- base "config:service-type";
- config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.RIB";
- config:disable-osgi-service-registration;
- }
-
- identity bgp-peer-registry {
- description
- "Registry of BGP peers. Every new BGP in/out connection looks for peers to handle bgp messages in this registry";
-
- base "config:service-type";
- config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry";
- config:disable-osgi-service-registration;
- }
-
- identity strict-bgp-peer-registry {
- description
- "Registry of BGP peers that allows only one connection per 2 peers. Uses IP address for Peer identification and BGP Ids to resolve duplicate connections";
-
- config:provided-service bgp-peer-registry;
- base config:module-type;
- config:java-name-prefix StrictBgpPeerRegistry;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case strict-bgp-peer-registry {
- when "/config:modules/config:module/config:type = 'strict-bgp-peer-registry'";
- }
- }
-
- identity bgp-peer {
- description
- "BGP peer instance.";
-
- base config:module-type;
- config:java-name-prefix BGPPeer;
- }
-
- identity bgp-application-peer {
- description
- "Application peer handler which handles translation from custom RIB into local RIB";
-
- base config:module-type;
- config:java-name-prefix BGPApplicationPeer;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-application-peer {
- when "/config:modules/config:module/config:type = 'bgp-application-peer'";
-
- container data-broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity sal:dom-async-data-broker;
- }
- }
- }
-
- container target-rib {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity rib-instance;
- }
- }
- }
-
- container bgp-peer-registry {
- description "BGP peer registry where current instance of BGP peer will be registered.";
- uses config:service-ref {
- refine type {
- // FIXME backwards compatibility. If not configured, GLOBAL instance is used
- mandatory false;
- config:required-identity bgp-peer-registry;
- }
- }
- }
-
- leaf application-rib-id {
- type rib:application-rib-id;
- mandatory true;
- }
-
- leaf bgp-peer-id {
- type bgp-t:bgp-id;
- mandatory true;
- }
- }
- }
-
- identity bgp-table-type {
- description
- "Service representing a AFI/SAFI pair";
-
- base "config:service-type";
- config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType";
- }
-
- identity add-path {
- base "config:service-type";
- config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.add.path.capability.AddressFamilies";
- }
-
- identity add-path-impl {
- config:provided-service add-path;
- base config:module-type;
- config:java-name-prefix AddPathImpl;
- }
-
- identity bgp-table-type-impl {
- description
- "Simple provider for bgp-table-type.";
-
- config:provided-service bgp-table-type;
- base config:module-type;
- config:java-name-prefix BGPTableTypeImpl;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-table-type-impl {
- when "/config:modules/config:module/config:type = 'bgp-table-type-impl'";
-
- uses bgp-mp:bgp-table-type;
- }
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case add-path-impl {
- when "/config:modules/config:module/config:type = 'add-path-impl'";
- container address-family {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bgp-table-type;
- }
- }
- }
- leaf send-receive {
- type bgp-mp:send-receive;
- mandatory true;
- }
- }
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-peer {
- when "/config:modules/config:module/config:type = 'bgp-peer'";
-
- uses peer:bgp-peer-config;
-
- list advertized-table {
- key "type name";
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bgp-table-type;
- }
- }
- }
-
- list add-path {
- key "type name";
- uses config:service-ref {
- refine type {
- config:required-identity add-path;
- }
- }
- }
-
- container rpc-registry {
- uses config:service-ref {
- refine type {
- mandatory false;
- config:required-identity mdsb:binding-rpc-registry;
- }
- }
- }
-
- container rib {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity rib-instance;
- }
- }
- }
-
- container peer-registry {
- description "BGP peer registry where current instance of BGP peer will be registered.";
- uses config:service-ref {
- refine type {
- // FIXME backwards compatibility. If not configured, GLOBAL instance is used
- mandatory false;
- config:required-identity bgp-peer-registry;
- }
- }
- }
- }
- }
-
- identity peer-rpc;
-
- augment "/config:modules/config:module/config:state" {
- case bgp-peer {
- when "/config:modules/config:module/config:type = 'bgp-peer'";
-
- rpcx:rpc-context-instance "peer-rpc";
- }
- }
-
- rpc reset-session {
- description "Restart the session between BGP peers";
- input {
- uses rpcx:rpc-context-ref {
- refine context-instance {
- rpcx:rpc-context-instance peer-rpc;
- }
- }
- }
- }
-
- identity bgp-path-selection-mode {
- description
- "Service representing an address family + path selection mode.";
-
- base "config:service-type";
- config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection";
- }
-
- identity bgp-psm-impl {
- base config:module-type;
- config:provided-service bgp-path-selection-mode;
- config:java-name-prefix BGPPSMImpl;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-psm-impl {
- when "/config:modules/config:module/config:type = 'bgp-psm-impl'";
- container path-address-family {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bgp-table-type;
- }
- }
- }
- container path-selection-mode {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bps:path-selection-mode-factory;
- }
- }
- }
- }
- }
-
- identity rib-impl {
- base config:module-type;
- config:provided-service bgprib:rib;
- config:provided-service rib-instance;
- config:java-name-prefix RIBImpl;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case rib-impl {
- when "/config:modules/config:module/config:type = 'rib-impl'";
-
- uses bgp-rib-impl:bgp-rib-impl-identifiers;
-
- container extensions {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity ribspi:consumer-extensions;
- }
- }
- }
-
- container bgp-dispatcher {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bgp-dispatcher;
- }
- }
- }
-
- container data-provider {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity mdsb:binding-async-data-broker;
- }
- }
- }
-
- container codec-tree-factory {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity mdsb1:binding-v1-codec-tree-factory;
- }
- }
- }
-
- container dom-data-provider {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity sal:dom-async-data-broker;
- }
- }
- }
-
- list local-table {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity bgp-table-type;
- }
- }
- }
-
- list rib-path-selection-mode {
- uses config:service-ref {
- refine type {
- config:required-identity bgp-path-selection-mode;
- }
- }
- }
- }
- }
-}
-
final List<OptionalCapabilities> capa = Lists.newArrayList();
capa.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class,
- new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
- .setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build())
- .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build())
+ new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
+ .setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build())
+ .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build())
.setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(AS_NUMBER).build()).build()).build());
capa.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capa).build());