Merge "Added definition of vendor-specific tlv into pcep-types. Added abstract vs...
authorRobert Varga <rovarga@cisco.com>
Fri, 7 Mar 2014 10:07:18 +0000 (10:07 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 7 Mar 2014 10:07:18 +0000 (10:07 +0000)
bgp/controller-config/src/main/resources/initial/31-bgp.xml
bgp/rib-impl-config/pom.xml
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java
bgp/rib-impl-config/src/main/yang/bgp-rib-impl.yang
bgp/rib-impl-config/src/test/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleTest.java
bgp/rib-impl-config/src/test/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModuleTest.java
bgp/rib-impl-config/src/test/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleTest.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImpl.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/Main.java
commons/parent/pom.xml

index 35e826f56114935c44f2b7136f711934d65ed253..a8be9f65eaec552c06d3f80117349731c7d61517 100644 (file)
                                        <bgp-extensions>
                                                <type xmlns:bgpspi="urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi">bgpspi:extensions</type>
                                                <name>global-bgp-extensions</name>
-                                       </bgp-extensions>
+                    </bgp-extensions>
+                    <timer>
+                                               <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-timer</type>
+                                               <name>global-timer</name>
+                    </timer>
                                        <boss-group>
                                                <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
                                                <name>global-boss-group</name>
index 4746f05e57d04a603b6e58c1c47919c6595a1f12..61a0e8efab9fd132f2b9e926431551567178a794 100644 (file)
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>netty-config-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>netty-timer-config</artifactId>
+        </dependency>
 
         <!--test dependencies -->
         <dependency>
index 6288afdae6c116f1ff6b116732f6b68851dff533..20ee2623caffb6314d59c037f367bb3a9b07a724 100644 (file)
@@ -40,15 +40,10 @@ org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPDispatcherImplMo
                super(name, dependencyResolver, oldModule, oldInstance);
        }
 
-       @Override
-       public void validate() {
-               super.validate();
-       }
-
        @Override
        public java.lang.AutoCloseable createInstance() {
                final BGPExtensionConsumerContext bgpExtensions = getBgpExtensionsDependency();
-               return new BGPDispatcherImpl(bgpExtensions.getMessageRegistry(),
+               return new BGPDispatcherImpl(bgpExtensions.getMessageRegistry(), getTimerDependency(),
                                getBossGroupDependency(), getWorkerGroupDependency());
        }
 }
index a48d3a51cf57ec719eb31089028d75f9e1416b93..865505d959b66883a2730a8f0dc36fed28bfefd3 100644 (file)
@@ -39,8 +39,7 @@ public final class RIBImplModule extends org.opendaylight.controller.config.yang
        }
 
        @Override
-       public void validate() {
-               super.validate();
+       public void customValidation() {
                JmxAttributeValidationException.checkNotNull(getExtensions(), "is not set.", this.extensionsJmxAttribute);
                JmxAttributeValidationException.checkNotNull(getRibId(), "is not set.", this.ribIdJmxAttribute);
                JmxAttributeValidationException.checkNotNull(getLocalAs(), "is not set.", this.localAsJmxAttribute);
index 720a11ff2d093e350bad9d12cb4470d958cf054f..9f958037db954171af6b89afad8d40c393b8ce3d 100644 (file)
@@ -75,6 +75,15 @@ module bgp-rib-impl {
                 }
             }
 
+            container timer {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity netty:netty-timer;
+                    }
+                }
+            }
+
             container boss-group {
                 uses config:service-ref {
                     refine type {
index c628bddf191621eaec2c6234c7af9df135797efd..dd820ea967f526d6ee9fabd1b660d0c1386d19b2 100644 (file)
@@ -23,6 +23,8 @@ import org.opendaylight.controller.config.yang.bgp.parser.spi.SimpleBGPExtension
 import org.opendaylight.controller.config.yang.bgp.rib.spi.RIBExtensionsImplModuleFactory;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
+import org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerModuleFactory;
+import org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerModuleMXBean;
 
 public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
 
@@ -36,13 +38,17 @@ public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
 
        private SimpleBGPExtensionProviderContextModuleFactory extensionFactory;
 
+       private HashedWheelTimerModuleFactory hwtFactory;
+
        @Before
        public void setUp() throws Exception {
                this.factory = new BGPDispatcherImplModuleFactory();
                this.threadgroupFactory = new NettyThreadgroupModuleFactory();
                this.messageFactory = new RIBExtensionsImplModuleFactory();
                this.extensionFactory = new SimpleBGPExtensionProviderContextModuleFactory();
-               super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, threadgroupFactory, messageFactory, extensionFactory));
+               this.hwtFactory = new HashedWheelTimerModuleFactory();
+               super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
+                               this.factory, threadgroupFactory, messageFactory, extensionFactory, hwtFactory));
        }
 
        @Test
@@ -53,7 +59,7 @@ public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
                transaction.validateConfig();
                CommitStatus status = transaction.commit();
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 4, 0, 0);
+               assertStatus(status, 5, 0, 0);
        }
 
        @Test
@@ -67,11 +73,11 @@ public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
                assertBeanCount(1, factory.getImplementationName());
                CommitStatus status = transaction.commit();
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 0, 0, 4);
+               assertStatus(status, 0, 0, 5);
        }
 
        public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
-                                            final String instanceName) throws InstanceAlreadyExistsException {
+                       final String instanceName) throws InstanceAlreadyExistsException {
                ObjectName nameCreated = transaction.createModule(
                                moduleName, instanceName);
                BGPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
@@ -79,6 +85,7 @@ public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
                mxBean.setBossGroup(createThreadgroupInstance(transaction, "boss-threadgroup", 10));
                mxBean.setWorkerGroup(createThreadgroupInstance(transaction, "worker-threadgroup", 10));
                mxBean.setBgpExtensions(createBgpExtensionsInstance(transaction, "bgp-extensions"));
+               mxBean.setTimer(createTimerInstance(transaction, ""));
                return nameCreated;
        }
 
@@ -94,10 +101,20 @@ public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
                return nameCreated;
        }
 
+       public static ObjectName createTimerInstance(final ConfigTransactionJMXClient transaction, final String instanceName)
+                       throws InstanceAlreadyExistsException {
+               ObjectName nameCreated = transaction.createModule(HashedWheelTimerModuleFactory.NAME,
+                               instanceName);
+               HashedWheelTimerModuleMXBean mxBean = transaction.newMBeanProxy(
+                               nameCreated, HashedWheelTimerModuleMXBean.class);
+               return nameCreated;
+
+       }
+
        public static ObjectName createBgpExtensionsInstance(
                        final ConfigTransactionJMXClient transaction,
                        final String instanceName)
-                       throws InstanceAlreadyExistsException {
+                                       throws InstanceAlreadyExistsException {
                ObjectName nameCreated = transaction.createModule(SimpleBGPExtensionProviderContextModuleFactory.NAME,
                                instanceName);
                transaction.newMBeanProxy(nameCreated,
index 2739f0f52ac3d56f6cae9e5b15e28fd212d9a377..6570b0c9bf83e6b31ba49921a59651a8ea4b31b4 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.controller.config.yang.md.sal.dom.impl.HashMapDataStoreM
 import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
 import org.opendaylight.controller.config.yang.reconnectstrategy.TimedReconnectStrategyModuleFactory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
@@ -114,7 +113,7 @@ public class BGPPeerModuleTest extends RIBImplModuleTest {
                transaction.validateConfig();
                final CommitStatus status = transaction.commit();
                assertBeanCount(1, BGPPeerModuleFactory.NAME);
-               assertStatus(status, 15, 0, 0);
+               assertStatus(status, 16, 0, 0);
        }
 
        @Override
@@ -138,7 +137,7 @@ public class BGPPeerModuleTest extends RIBImplModuleTest {
                assertBeanCount(1, BGPPeerModuleFactory.NAME);
                status = transaction.commit();
                assertBeanCount(1, BGPPeerModuleFactory.NAME);
-               assertStatus(status, 0, 0, 15);
+               assertStatus(status, 0, 0, 16);
        }
 
        @Test
@@ -154,6 +153,6 @@ public class BGPPeerModuleTest extends RIBImplModuleTest {
                mxBean.setPort(new PortNumber(10));
                status = transaction.commit();
                assertBeanCount(1, BGPPeerModuleFactory.NAME);
-               assertStatus(status, 0, 1, 14);
+               assertStatus(status, 0, 1, 15);
        }
 }
index 17fe31a731acd10c48f2302d62a81552985b3ee0..d6896e9d1b893d3ad18768a5140eb57177f1c2db 100644 (file)
@@ -45,6 +45,7 @@ import org.opendaylight.controller.config.yang.md.sal.dom.impl.HashMapDataStoreM
 import org.opendaylight.controller.config.yang.md.sal.dom.impl.HashMapDataStoreModuleMXBean;
 import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
+import org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerModuleFactory;
 import org.opendaylight.controller.config.yang.reconnectstrategy.TimedReconnectStrategyModuleFactory;
 import org.opendaylight.controller.config.yang.store.impl.YangParserWrapper;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
@@ -82,6 +83,7 @@ public class RIBImplModuleTest extends AbstractConfigTest {
        private DomBrokerImplModuleFactory domBrokerFactory;
        private RuntimeMappingModuleFactory runtimeMappingFactory;
        private HashMapDataStoreModuleFactory dataStroreFactory;
+       private HashedWheelTimerModuleFactory hwtFactory;
 
        @Mock
        private DataModificationTransaction mockedTransaction;
@@ -111,6 +113,7 @@ public class RIBImplModuleTest extends AbstractConfigTest {
                this.domBrokerFactory = new DomBrokerImplModuleFactory();
                this.runtimeMappingFactory = new RuntimeMappingModuleFactory();
                this.dataStroreFactory = new HashMapDataStoreModuleFactory();
+               this.hwtFactory = new HashedWheelTimerModuleFactory();
 
                List<ModuleFactory> moduleFactories = getModuleFactories();
                super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, moduleFactories
@@ -182,7 +185,7 @@ public class RIBImplModuleTest extends AbstractConfigTest {
                                this.dispactherFactory, this.threadgroupFactory,
                                this.reconnectFactory, this.dataBrokerFactory, this.executorFactory, this.extensionFactory,
                                this.ribExtensionsFactory, this.domBrokerFactory, this.runtimeMappingFactory,
-                               this.dataStroreFactory);
+                               this.dataStroreFactory, this.hwtFactory);
        }
 
        @Override
@@ -213,7 +216,7 @@ public class RIBImplModuleTest extends AbstractConfigTest {
                CommitStatus status = transaction.commit();
                Thread.sleep(2000);
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 13, 0, 0);
+               assertStatus(status, 14, 0, 0);
        }
 
        @After
@@ -276,15 +279,15 @@ public class RIBImplModuleTest extends AbstractConfigTest {
 
        public static ObjectName lookupMappingServiceInstance(final ConfigTransactionJMXClient transaction) {
 
-        try {
-            return transaction.lookupConfigBean(RuntimeMappingModuleFactory.NAME, RuntimeMappingModuleFactory.SINGLETON_NAME);
-        } catch (InstanceNotFoundException e) {
-            try {
-                return transaction.createModule(RuntimeMappingModuleFactory.NAME, RuntimeMappingModuleFactory.SINGLETON_NAME);
-            } catch (InstanceAlreadyExistsException e1) {
-                throw new IllegalStateException(e1);
-            }
-        }
+               try {
+                       return transaction.lookupConfigBean(RuntimeMappingModuleFactory.NAME, RuntimeMappingModuleFactory.SINGLETON_NAME);
+               } catch (InstanceNotFoundException e) {
+                       try {
+                               return transaction.createModule(RuntimeMappingModuleFactory.NAME, RuntimeMappingModuleFactory.SINGLETON_NAME);
+                       } catch (InstanceAlreadyExistsException e1) {
+                               throw new IllegalStateException(e1);
+                       }
+               }
        }
 
        public static ObjectName createRibExtensionsInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
index 044e239ffa871aa77c318f78265996deac584344..984c7a859b7596d102553f7cd1cb318cfca8b6a1 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
-import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.Promise;
@@ -26,16 +25,18 @@ import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
+import com.google.common.base.Preconditions;
+
 /**
  * Implementation of BGPDispatcher.
  */
 public final class BGPDispatcherImpl extends AbstractDispatcher<BGPSessionImpl, BGPSessionListener> implements BGPDispatcher, AutoCloseable {
-       private final Timer timer = new HashedWheelTimer();
-
        private final BGPHandlerFactory hf;
+       private final Timer timer;
 
-       public BGPDispatcherImpl(final MessageRegistry messageRegistry, final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) {
+       public BGPDispatcherImpl(final MessageRegistry messageRegistry, final Timer timer, final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) {
                super(bossGroup, workerGroup);
+               this.timer = Preconditions.checkNotNull(timer);
                this.hf = new BGPHandlerFactory(messageRegistry);
        }
 
index a7fef42ddfa90c84cdea9b8e94bfd7bd7ff890a6..dae066981f77f4a67081916104c1c6c287494cc7 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.protocol.bgp.testtool;
 
 import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.GlobalEventExecutor;
 
 import java.net.InetAddress;
@@ -62,7 +63,8 @@ public final class Main {
        private static final int RECONNECT_MILLIS = 5000;
 
        private Main() throws Exception {
-               this.dispatcher = new BGPDispatcherImpl(ServiceLoaderBGPExtensionProviderContext.createConsumerContext().getMessageRegistry(), new NioEventLoopGroup(), new NioEventLoopGroup());
+               this.dispatcher = new BGPDispatcherImpl(ServiceLoaderBGPExtensionProviderContext.createConsumerContext().getMessageRegistry(),
+                               new HashedWheelTimer(), new NioEventLoopGroup(), new NioEventLoopGroup());
        }
 
        public static void main(final String[] args) throws Exception {
index 95a5aa420bd2a44105ff46803f8d83808b970d9d..9a0cc392fcaede9efc2d0374b57459fb09198055 100644 (file)
                 <artifactId>netty-config-api</artifactId>
                 <version>${controller.config.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>netty-timer-config</artifactId>
+                <version>${controller.config.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>sal-binding-api</artifactId>