From 2e4d8b49d4470d6121e056f16bf7e15429a21e5a Mon Sep 17 00:00:00 2001 From: "Claudio D. Gasparini" Date: Wed, 25 Oct 2017 08:57:28 +0200 Subject: [PATCH] BGPCEP-685: Remove BGP Config subsystem models Change-Id: I1d66738f637882eb1aadbbd9f94a4e1fd65d795a Signed-off-by: Claudio D. Gasparini --- .../yang/bgp/rib/impl/AddPathImplModule.java | 91 ---- .../rib/impl/AddPathImplModuleFactory.java | 11 - .../rib/impl/BGPApplicationPeerModule.java | 72 ---- .../impl/BGPApplicationPeerModuleFactory.java | 32 -- .../bgp/rib/impl/BGPDispatcherImplModule.java | 74 ---- .../impl/BGPDispatcherImplModuleFactory.java | 44 -- .../yang/bgp/rib/impl/BGPPSMImplModule.java | 74 ---- .../bgp/rib/impl/BGPPSMImplModuleFactory.java | 11 - .../yang/bgp/rib/impl/BGPPeerModule.java | 136 ------ .../bgp/rib/impl/BGPPeerModuleFactory.java | 45 -- .../bgp/rib/impl/BGPTableTypeImplModule.java | 95 ---- .../impl/BGPTableTypeImplModuleFactory.java | 25 -- .../yang/bgp/rib/impl/RIBImplModule.java | 45 -- .../bgp/rib/impl/RIBImplModuleFactory.java | 24 -- .../rib/impl/StrictBgpPeerRegistryModule.java | 61 --- .../StrictBgpPeerRegistryModuleFactory.java | 34 -- .../protocol/bgp/rib/impl/BGPPeer.java | 26 +- bgp/rib-impl/src/main/yang/bgp-peer.yang | 141 ------ bgp/rib-impl/src/main/yang/bgp-rib-impl.yang | 52 --- .../src/main/yang/odl-bgp-rib-impl-cfg.yang | 407 ------------------ .../bgp/rib/impl/BGPSessionImplTest.java | 6 +- 21 files changed, 11 insertions(+), 1495 deletions(-) delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModuleFactory.java delete mode 100755 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModuleFactory.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModuleFactory.java delete mode 100755 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModuleFactory.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModuleFactory.java delete mode 100755 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModule.java delete mode 100644 bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModuleFactory.java delete mode 100644 bgp/rib-impl/src/main/yang/bgp-peer.yang delete mode 100644 bgp/rib-impl/src/main/yang/bgp-rib-impl.yang delete mode 100644 bgp/rib-impl/src/main/yang/odl-bgp-rib-impl-cfg.yang diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModule.java deleted file mode 100644 index c16055e89f..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModule.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 getImplementedInterface() { - return AddressFamilies.class; - } - - @Override - public void close() throws Exception { - } - - @Override - public > E getAugmentation(final Class arg0) { - return null; - } - - @Override - public Class getAfi() { - return this.family.getAfi(); - } - - @Override - public Class getSafi() { - return this.family.getSafi(); - } - - @Override - public SendReceive getSendReceive() { - return this.sendReceiveMode; - } - } - -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModuleFactory.java deleted file mode 100644 index 965ddb0b4d..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AddPathImplModuleFactory.java +++ /dev/null @@ -1,11 +0,0 @@ -/* - * 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 { -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModule.java deleted file mode 100755 index 9d5c702308..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModule.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 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 protocolIId = bgpDeployer.getInstanceIdentifier().child(Protocols.class) - .child(Protocol.class, new ProtocolKey(BGP.class, rib.getInstanceIdentifier().getKey().getId().getValue())); - final InstanceIdentifier bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class); - final KeyedInstanceIdentifier 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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModuleFactory.java deleted file mode 100644 index a16a59a92e..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModuleFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java deleted file mode 100644 index 9cef9bb206..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 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 { - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java deleted file mode 100644 index d88dc73e1e..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModule.java deleted file mode 100644 index 5792fe3838..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModule.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 getAfi() { - return this.pathFamilyDependency.getAfi(); - } - - @Override - public Class getSafi() { - return this.pathFamilyDependency.getSafi(); - } - - @Override - public Class 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()); - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModuleFactory.java deleted file mode 100644 index 0d2c403f6f..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPSMImplModuleFactory.java +++ /dev/null @@ -1,11 +0,0 @@ -/* - * 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 { - -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModule.java deleted file mode 100755 index c1a0473230..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModule.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 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 protocolIId = bgpDeployer.getInstanceIdentifier().child(Protocols.class) - .child(Protocol.class, new ProtocolKey(BGP.class, rib.getInstanceIdentifier().getKey().getId().getValue())); - final InstanceIdentifier bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class); - final KeyedInstanceIdentifier 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 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 { - } - -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModuleFactory.java deleted file mode 100644 index 31db8eb7df..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModuleFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - } - -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModule.java deleted file mode 100644 index 77abcbd0a3..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModule.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 afi; - private final Class safi; - - public AutoCloseableBgpTableType(final Class afi, final Class safi) { - this.afi = requireNonNull(afi); - this.safi = requireNonNull(safi); - } - - @Override - public Class getImplementedInterface() { - return BgpTableType.class; - } - - @Override - public Class getAfi() { - return this.afi; - } - - @Override - public Class 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(); - } - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModuleFactory.java deleted file mode 100644 index bce92ef6eb..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPTableTypeImplModuleFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 { - -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java deleted file mode 100755 index 05859899a8..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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: rib-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; - -/** - * - */ -@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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java deleted file mode 100644 index e6effda1b7..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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: rib-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; - -/** - * - */ -@Deprecated -public class RIBImplModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModuleFactory { -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModule.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModule.java deleted file mode 100644 index b27f2c2ed6..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModule.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModuleFactory.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModuleFactory.java deleted file mode 100644 index eec255e4ca..0000000000 --- a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/StrictBgpPeerRegistryModuleFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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; - } -} diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java index b4c2cb19f5..2574ec5431 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java @@ -28,7 +28,6 @@ import java.util.Set; 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; @@ -116,7 +115,6 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee private final RIB rib; private final String name; - private BGPPeerRuntimeRegistration runtimeReg; private final Map adjRibOutListenerSet = new HashMap<>(); private final RpcProviderRegistry rpcRegistry; private RoutedRpcRegistration rpcRegistration; @@ -426,23 +424,7 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee } closeRegistration(); final ListenableFuture 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(); @@ -451,6 +433,14 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee } this.session = null; } + + resetState(); + return future; + } + + private void closeRegistration() { + this.tableRegistration.iterator().forEachRemaining(AbstractRegistration::close); + this.tableRegistration.clear(); } @Override diff --git a/bgp/rib-impl/src/main/yang/bgp-peer.yang b/bgp/rib-impl/src/main/yang/bgp-peer.yang deleted file mode 100644 index eec7c648ef..0000000000 --- a/bgp/rib-impl/src/main/yang/bgp-peer.yang +++ /dev/null @@ -1,141 +0,0 @@ -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 "; - - 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; - } - } -} diff --git a/bgp/rib-impl/src/main/yang/bgp-rib-impl.yang b/bgp/rib-impl/src/main/yang/bgp-rib-impl.yang deleted file mode 100644 index 0f01cc99bf..0000000000 --- a/bgp/rib-impl/src/main/yang/bgp-rib-impl.yang +++ /dev/null @@ -1,52 +0,0 @@ -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 "; - - 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 diff --git a/bgp/rib-impl/src/main/yang/odl-bgp-rib-impl-cfg.yang b/bgp/rib-impl/src/main/yang/odl-bgp-rib-impl-cfg.yang deleted file mode 100644 index d4e661f7cc..0000000000 --- a/bgp/rib-impl/src/main/yang/odl-bgp-rib-impl-cfg.yang +++ /dev/null @@ -1,407 +0,0 @@ -// 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 "; - - 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; - } - } - } - } - } -} - diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.java index d0f07720fa..664a3d45d8 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.java @@ -101,9 +101,9 @@ public class BGPSessionImplTest { final List 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()); -- 2.36.6