Convert PCEPDispatcher wiring to blueprint 54/41854/4
authorTom Pantelis <tpanteli@brocade.com>
Wed, 13 Jul 2016 00:41:41 +0000 (20:41 -0400)
committerMilos Fabian <milfabia@cisco.com>
Mon, 1 Aug 2016 12:13:38 +0000 (12:13 +0000)
The wiring was added to the pcep-impl.xml file.

Moved the max-unknown-messages and tls config to a new
pcep-dispatcher-config container in the pcep-app-config.yang. This
changed the package for the generated Tls class.

The md5 factpry wiring was ommitted b/c it is being removed in a another patch
anyway. The PCEPTopologyProviderModule did some fancy checking to see if md5 was
enabled. This checking was removed to avoid compilation error.

The PCEPDispatcherImplModule was deprecated but still remains for now
to provide the PCEPDispatcher instance created via blueprint to the
config system so it can be injected into other users. Once the other user(s)
are converted to blueprint then the config yang, Module classes can be removed.

The SimplePCEPExtensionProviderContextModule and yang were removed as
all users are now converted to blueprint. Same with
PCEPSessionProposalFactoryImplModule.

Change-Id: I8c5a12cedbafbe54f492d01f6d0a3c608f49508a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
24 files changed:
pcep/api/src/main/yang/odl-pcep-api-cfg.yang
pcep/controller-config/src/main/resources/initial/32-pcep.xml
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModule.java
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleFactory.java
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java [deleted file]
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java [deleted file]
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/AbstractPCEPSessionNegotiator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/DefaultPCEPSessionNegotiator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/DefaultPCEPSessionNegotiatorFactory.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tls/SslContextFactory.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tls/SslKeyStore.java
pcep/impl/src/main/resources/org/opendaylight/blueprint/pcep-impl.xml
pcep/impl/src/main/yang/odl-pcep-impl-cfg.yang
pcep/impl/src/main/yang/pcep-app-config.yang
pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleTest.java [deleted file]
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/FiniteStateMachineTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/SslContextFactoryTest.java
pcep/spi/pom.xml
pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java [deleted file]
pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java [deleted file]
pcep/spi/src/main/yang/odl-pcep-spi-cfg.yang [deleted file]
pcep/topology-provider/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModule.java
pcep/topology-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModuleTest.java
pcep/tunnel-provider/src/test/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleTest.java

index af8f52e12f36b5089bc7f0c8b63e50a7ff2d233c..2c810e2f856e74614f7ae9a9646897505634da9a 100644 (file)
@@ -33,23 +33,7 @@ module odl-pcep-api-cfg {
 
         base "config:service-type";
         config:java-class "org.opendaylight.protocol.pcep.PCEPDispatcher";
-    }
-
-    identity pcep-session-proposal-factory {
-        description
-            "Service representing a PCEP session proposal factory service. The service
-             provides initial session attributes given by the user.";
-
-        base "config:service-type";
-        config:java-class "org.opendaylight.protocol.pcep.PCEPSessionProposalFactory";
         config:disable-osgi-service-registration;
     }
-
-    identity pcep-capability {
-        description "Service for storing usability of specific capabilities during
-            opened PCEP session.";
-        base "config:service-type";
-        config:java-class "org.opendaylight.protocol.pcep.PCEPCapability";
-    }
 }
 
index 29819505005bf17ef3a82f14e46a589de2c0e20e..83945dec26516a710c0c5acde272f0642c564ce1 100644 (file)
@@ -9,68 +9,19 @@
 -->
 <snapshot>
     <required-capabilities>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:netty?module=netty&amp;revision=2013-11-19</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:impl?module=odl-pcep-impl-cfg&amp;revision=2013-06-27</capability>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:spi?module=odl-pcep-spi-cfg&amp;revision=2013-11-15</capability>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:programming:spi?module=odl-programming-spi-cfg&amp;revision=2013-11-15</capability>
     </required-capabilities>
     <configuration>
 
         <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
             <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
-                    <name>global-pcep-extensions</name>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">prefix:pcep-session-proposal-factory-impl</type>
-                    <name>global-pcep-session-proposal-factory</name>
-                </module>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">prefix:pcep-dispatcher-impl</type>
                     <name>global-pcep-dispatcher</name>
-                    <pcep-extensions>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extensions</type>
-                        <name>global-pcep-extensions</name>
-                    </pcep-extensions>
-                    <pcep-session-proposal-factory>
-                        <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">pcep:pcep-session-proposal-factory</type>
-                        <name>global-pcep-session-proposal-factory</name>
-                    </pcep-session-proposal-factory>
-                    <boss-group>
-                        <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
-                        <name>global-boss-group</name>
-                    </boss-group>
-                    <worker-group>
-                        <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
-                        <name>global-worker-group</name>
-                    </worker-group>
-                    <!--
-                        Uncomment this block to enable PCEPS TLS communication. Change example values as needed.
-                    <tls>
-                       <keystore>configuration/ctl.jks</keystore>
-                       <keystore-type>JKS</keystore-type>
-                       <keystore-path-type>PATH</keystore-path-type>
-                       <keystore-password>opendaylight</keystore-password>
-                       <truststore>configuration/truststore.jks</truststore>
-                       <truststore-type>JKS</truststore-type>
-                       <truststore-path-type>PATH</truststore-path-type>
-                       <truststore-password>opendaylight</truststore-password>
-                       <certificate-password>opendaylight</certificate-password>
-                     </tls>
-                     -->
                 </module>
             </modules>
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-                <service>
-                    <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extensions</type>
-                    <instance>
-                        <name>global-pcep-extensions</name>
-                        <provider>/config/modules/module[name='pcep-extensions-impl']/instance[name='global-pcep-extensions']</provider>
-                    </instance>
-                </service>
                 <service>
                     <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">pcep:pcep-dispatcher</type>
                     <instance>
                         <provider>/config/modules/module[name='pcep-dispatcher-impl']/instance[name='global-pcep-dispatcher']</provider>
                     </instance>
                 </service>
-                <service>
-                    <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">pcep:pcep-session-proposal-factory</type>
-                    <instance>
-                        <name>global-pcep-session-proposal-factory</name>
-                        <provider>/config/modules/module[name='pcep-session-proposal-factory-impl']/instance[name='global-pcep-session-proposal-factory']</provider>
-                    </instance>
-                </service>
             </services>
         </data>
 
index 8050e3539c09587d18ba269edf8f57ee7fb4788c..36f0ab79fe5a24407cb6da9eba7b55b5397851ff 100644 (file)
  */
 package org.opendaylight.controller.config.yang.pcep.impl;
 
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
-import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
+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.pcep.PCEPDispatcher;
+import org.osgi.framework.BundleContext;
 
 /**
- *
+ * @deprecated Replaced by blueprint wiring
  */
-public final class PCEPDispatcherImplModule extends org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModule {
-
-    private static final String VALUE_IS_NOT_SET = "value is not set.";
-    private static final String KEYSTORE = "keystore";
-    private static final String TRUSTSTORE = "truststore";
-    private static final String PASSWORD = " password ";
-    private static final String LOCATION = " location ";
-    private static final String TYPE = " type ";
-    private static final String PATH_TYPE = " path" + TYPE;
+@Deprecated
+public final class PCEPDispatcherImplModule extends AbstractPCEPDispatcherImplModule {
+    private BundleContext bundleContext;
 
     public PCEPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
@@ -45,28 +42,28 @@ public final class PCEPDispatcherImplModule extends org.opendaylight.controller.
     }
 
     @Override
-    public void validate() {
-        super.validate();
-        JmxAttributeValidationException.checkNotNull(getMaxUnknownMessages(), VALUE_IS_NOT_SET, maxUnknownMessagesJmxAttribute);
-        JmxAttributeValidationException.checkCondition(getMaxUnknownMessages() > 0, "Parameter 'maxUnknownMessages' "
-                + "must be greater than 0", maxUnknownMessagesJmxAttribute);
-        if (getTls() != null) {
-            JmxAttributeValidationException.checkNotNull(getTls().getCertificatePassword(), "certificate" + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getKeystore(), KEYSTORE + LOCATION + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getKeystorePassword(), KEYSTORE + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getKeystorePathType(), KEYSTORE + PATH_TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getKeystoreType(), KEYSTORE + TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getTruststore(), TRUSTSTORE + LOCATION + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getTruststorePassword(), TRUSTSTORE + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getTruststorePathType(), TRUSTSTORE + PATH_TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(getTls().getTruststoreType(), TRUSTSTORE + TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
-        }
+    public AutoCloseable createInstance() {
+        final WaitingServiceTracker<PCEPDispatcher> tracker =
+                WaitingServiceTracker.create(PCEPDispatcher.class, bundleContext);
+        final PCEPDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+        return Reflection.newProxy(AutoCloseablePCEPDispatcher.class, new AbstractInvocationHandler() {
+            @Override
+            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+                if (method.getName().equals("close")) {
+                    tracker.close();
+                    return null;
+                } else {
+                    return method.invoke(service, args);
+                }
+            }
+        });
     }
 
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final DefaultPCEPSessionNegotiatorFactory negFactory = new DefaultPCEPSessionNegotiatorFactory(getPcepSessionProposalFactoryDependency(), getMaxUnknownMessages(), getTls());
+    void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
 
-        return new PCEPDispatcherImpl(getPcepExtensionsDependency().getMessageHandlerRegistry(), negFactory, getBossGroupDependency(), getWorkerGroupDependency());
+    private static interface AutoCloseablePCEPDispatcher extends PCEPDispatcher, AutoCloseable {
     }
 }
index b54ca96e0675773a9b71eb649e892557d2468af9..5b7f1c6c611998cdac7615b3dae03624d17edbf7 100644 (file)
  */
 package org.opendaylight.controller.config.yang.pcep.impl;
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
 /**
-*
-*/
-public class PCEPDispatcherImplModuleFactory extends
-        org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModuleFactory {
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class PCEPDispatcherImplModuleFactory extends AbstractPCEPDispatcherImplModuleFactory {
+    @Override
+    public PCEPDispatcherImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            PCEPDispatcherImplModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        PCEPDispatcherImplModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+                oldInstance, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
 
+    @Override
+    public PCEPDispatcherImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        PCEPDispatcherImplModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
 }
diff --git a/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java b/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java
deleted file mode 100644 (file)
index 3be15a3..0000000
+++ /dev/null
@@ -1,69 +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: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:16:39 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.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.pcep.PCEPSessionProposalFactory;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public final class PCEPSessionProposalFactoryImplModule extends AbstractPCEPSessionProposalFactoryImplModule {
-    private BundleContext bundleContext;
-
-    public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(name, dependencyResolver);
-    }
-
-    public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final PCEPSessionProposalFactoryImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(name, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final WaitingServiceTracker<PCEPSessionProposalFactory> tracker =
-                WaitingServiceTracker.create(PCEPSessionProposalFactory.class, bundleContext);
-        final PCEPSessionProposalFactory service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
-        return Reflection.newProxy(AutoCloseablePCEPSessionProposalFactory.class, new AbstractInvocationHandler() {
-            @Override
-            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
-                if (method.getName().equals("close")) {
-                    tracker.close();
-                    return null;
-                } else {
-                    return method.invoke(service, args);
-                }
-            }
-        });
-    }
-
-    void setBundleContext(BundleContext bundleContext) {
-        this.bundleContext = bundleContext;
-    }
-
-    private static interface AutoCloseablePCEPSessionProposalFactory extends PCEPSessionProposalFactory, AutoCloseable {
-    }
-}
diff --git a/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java b/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java
deleted file mode 100644 (file)
index 5a7d65d..0000000
+++ /dev/null
@@ -1,43 +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: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 13:16:39 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class PCEPSessionProposalFactoryImplModuleFactory extends AbstractPCEPSessionProposalFactoryImplModuleFactory {
-    @Override
-    public PCEPSessionProposalFactoryImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
-            PCEPSessionProposalFactoryImplModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
-        PCEPSessionProposalFactoryImplModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
-                oldInstance, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-
-    @Override
-    public PCEPSessionProposalFactoryImplModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
-            BundleContext bundleContext) {
-        PCEPSessionProposalFactoryImplModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-}
index f9886551e1735e6b7707458cdaacbe79156890b3..06a8ea0f7f16e2f176f3349eb37181d1e1560e4c 100644 (file)
@@ -19,10 +19,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
 import org.opendaylight.protocol.pcep.impl.spi.Util;
 import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder;
index f74807438642fe708a80319af63e132e337581de..f019c34eaa8089ea0df317e0928d2178e35bf099 100644 (file)
@@ -11,8 +11,8 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Promise;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder;
 
index fb7196001a090705b001426271d84234f2089de3..eb7b38cd8b518d28c85f2aef7d78b829c5ff502f 100644 (file)
@@ -11,10 +11,11 @@ import com.google.common.base.Preconditions;
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Promise;
 import java.net.InetSocketAddress;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
 import org.opendaylight.protocol.pcep.PCEPPeerProposal;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PcepDispatcherConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
 
 public final class DefaultPCEPSessionNegotiatorFactory extends AbstractPCEPSessionNegotiatorFactory {
     private final PCEPSessionProposalFactory spf;
@@ -31,6 +32,10 @@ public final class DefaultPCEPSessionNegotiatorFactory extends AbstractPCEPSessi
         this.tlsConfiguration = tlsConfiguration;
     }
 
+    public DefaultPCEPSessionNegotiatorFactory(final PCEPSessionProposalFactory spf, final PcepDispatcherConfig config) {
+        this(spf, config.getMaxUnknownMessages(), config.getTls());
+    }
+
     @Override
     protected AbstractPCEPSessionNegotiator createNegotiator(final Promise<PCEPSessionImpl> promise, final PCEPSessionListener listener,
             final Channel channel, final short sessionId, final PCEPPeerProposal peerProposal) {
index f7d91f6e9010be6cfb12e8603f0564a7e9a195c7..13b01a97af775482e6379520f65413354596e8cd 100644 (file)
@@ -15,7 +15,7 @@ import java.security.cert.CertificateException;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManagerFactory;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index fb0bfdae6298f3f4d33107b9a42d249a398b907b..5c49c083d6d1fbbda919f3cc63cffcb1036a2164 100644 (file)
@@ -12,7 +12,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 6af29bb7cf389fa1d1b8d7bfdffeef6b9426dae4..fb7f24d4fc920ff4a7419c2fe14a51283e98d0c7 100644 (file)
     <argument ref="pcepCapabilities"/>
   </bean>
 
-  <service ref="sessionProposalFactory" interface="org.opendaylight.protocol.pcep.PCEPSessionProposalFactory"/>
+  <!-- PCEPDispatcher -->
+
+  <reference id="pcepExtensionContext" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext"/>
+  <reference id="globalBossGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-boss-group"/>
+  <reference id="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group"/>
+
+  <odl:clustered-app-config id="pcepDispatcherConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PcepDispatcherConfig"/>
+
+  <bean id="pcepSessionNegotiatorFactory" class="org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory">
+    <argument ref="sessionProposalFactory"/>
+    <argument ref="pcepDispatcherConfig"/>
+  </bean>
+
+  <bean id="pcepDispatcher" class="org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl">
+    <argument>
+      <bean factory-ref="pcepExtensionContext" factory-method="getMessageHandlerRegistry"/>
+    </argument>
+    <argument ref="pcepSessionNegotiatorFactory"/>
+    <argument ref="globalBossGroup"/>
+    <argument ref="globalWorkerGroup"/>
+  </bean>
+
+  <service ref="pcepDispatcher" interface="org.opendaylight.protocol.pcep.PCEPDispatcher"/>
 </blueprint>
\ No newline at end of file
index 9e69deaf07435c81fba7b75bbb0eb6a1d67545e8..1d76377ecee96e5e48e158efba8cbd89bcaf5c49 100644 (file)
@@ -6,8 +6,6 @@ module odl-pcep-impl-cfg {
 
     import config { prefix config; revision-date 2013-04-05; }
     import odl-pcep-api-cfg { prefix pcep; revision-date 2013-04-09; }
-    import odl-pcep-spi-cfg { prefix spi; revision-date 2013-11-15; }
-    import netty { prefix netty; revision-date 2013-11-19; }
 
     organization "Cisco Systems, Inc.";
 
@@ -34,20 +32,6 @@ module odl-pcep-impl-cfg {
             "Initial revision";
     }
 
-    typedef path-type {
-        type enumeration {
-            enum "PATH";
-            enum "CLASSPATH";
-        }
-    }
-
-    typedef store-type {
-        type enumeration {
-            enum "JKS";
-            enum "PKCS12";
-        }
-    }
-
     identity pcep-dispatcher-impl {
         base config:module-type;
         config:provided-service pcep:pcep-dispatcher;
@@ -57,107 +41,6 @@ module odl-pcep-impl-cfg {
     augment "/config:modules/config:module/config:configuration" {
         case pcep-dispatcher-impl {
             when "/config:modules/config:module/config:type = 'pcep-dispatcher-impl'";
-
-            leaf max-unknown-messages {
-                type uint16;
-                default 5;
-            }
-
-            container pcep-extensions {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity spi:consumer-extensions;
-                    }
-                }
-            }
-
-            container pcep-session-proposal-factory {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity pcep:pcep-session-proposal-factory;
-                    }
-                }
-            }
-
-            container boss-group {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity netty:netty-threadgroup;
-                    }
-                }
-            }
-
-            container worker-group {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity netty:netty-threadgroup;
-                    }
-                }
-            }
-
-            container tls {
-                leaf keystore {
-                    description "keystore location";
-                    type string;
-                    mandatory true;
-                }
-                leaf keystore-type {
-                    description "keystore type (JKS or PKCS12)";
-                    type store-type;
-                    mandatory true;
-                }
-                leaf keystore-path-type {
-                    description "keystore path type (CLASSPATH or PATH)";
-                    type path-type;
-                    mandatory true;
-                }
-                leaf keystore-password {
-                    description "password protecting keystore";
-                    type string;
-                    mandatory true;
-                }
-                leaf certificate-password {
-                    description "password protecting certificate";
-                    type string;
-                    mandatory true;
-                }
-                leaf truststore {
-                    description "truststore location";
-                    type string;
-                    mandatory true;
-                }
-                leaf truststore-type {
-                    description "truststore type (JKS or PKCS12)";
-                    type store-type;
-                    mandatory true;
-                }
-                leaf truststore-path-type {
-                    description "truststore path type (CLASSPATH or PATH)";
-                    type path-type;
-                    mandatory true;
-                }
-                leaf truststore-password {
-                    description "password protecting truststore";
-                    type string;
-                    mandatory true;
-                }
-            }
-        }
-    }
-
-    identity pcep-session-proposal-factory-impl {
-        base config:module-type;
-        config:java-name-prefix "PCEPSessionProposalFactoryImpl";
-        config:provided-service pcep:pcep-session-proposal-factory;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-session-proposal-factory-impl {
-            when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-impl'";
         }
     }
 }
index e5b7f57b1e8bcba9d42f77c5c2f70a9179ecadf4..579b1dc2967036e2aa97e42ecb6dd6561b05f769 100644 (file)
@@ -22,4 +22,76 @@ module pcep-app-config {
             default 30;
         }
     }
+
+    typedef path-type {
+        type enumeration {
+            enum "PATH";
+            enum "CLASSPATH";
+        }
+    }
+
+    typedef store-type {
+        type enumeration {
+            enum "JKS";
+            enum "PKCS12";
+        }
+    }
+
+    container pcep-dispatcher-config {
+        leaf max-unknown-messages {
+            type uint16 {
+                range "1..max";
+            }
+            default 5;
+        }
+
+        container tls {
+            presence true;
+            leaf keystore {
+                description "keystore location";
+                type string;
+                mandatory true;
+            }
+            leaf keystore-type {
+                description "keystore type (JKS or PKCS12)";
+                type store-type;
+                mandatory true;
+            }
+            leaf keystore-path-type {
+                description "keystore path type (CLASSPATH or PATH)";
+                type path-type;
+                mandatory true;
+            }
+            leaf keystore-password {
+                description "password protecting keystore";
+                type string;
+                mandatory true;
+            }
+            leaf certificate-password {
+                description "password protecting certificate";
+                type string;
+                mandatory true;
+            }
+            leaf truststore {
+                description "truststore location";
+                type string;
+                mandatory true;
+            }
+            leaf truststore-type {
+                description "truststore type (JKS or PKCS12)";
+                type store-type;
+                mandatory true;
+            }
+            leaf truststore-path-type {
+                description "truststore path type (CLASSPATH or PATH)";
+                type path-type;
+                mandatory true;
+            }
+            leaf truststore-password {
+                description "password protecting truststore";
+                type string;
+                mandatory true;
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleTest.java b/pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleTest.java
deleted file mode 100644 (file)
index 9330050..0000000
+++ /dev/null
@@ -1,320 +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
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.contains;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import io.netty.channel.EventLoopGroup;
-import java.util.Collections;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
-import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleMXBean;
-import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
-import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.PathType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.StoreType;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
-
-    private static final String INSTANCE_NAME = "pcep-dispatcher-impl";
-    private static final String FACTORY_NAME = PCEPDispatcherImplModuleFactory.NAME;
-
-    private static final String THREADGROUP_FACTORY_NAME = NettyThreadgroupModuleFactory.NAME;
-    private static final String BOSS_TG_INSTANCE_NAME = "boss-group";
-    private static final String WORKER_TG_INSTANCE_NAME = "worker-group";
-
-    private static final String EXTENSION_INSTANCE_NAME = "pcep-extension-privider";
-    private static final String EXTENSION_FACTORYNAME = SimplePCEPExtensionProviderContextModuleFactory.NAME;
-
-    private static final String STORE_PASSWORD = "opendaylight";
-    private static final String KEYSTORE = "ctl.jks";
-    private static final String TRUSTSTORE = "truststore.jks";
-
-    @Before
-    public void setUp() throws Exception {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new PCEPDispatcherImplModuleFactory(), new PCEPSessionProposalFactoryImplModuleFactory(), new NettyThreadgroupModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-
-        doAnswer(new Answer<Filter>() {
-            @Override
-            public Filter answer(InvocationOnMock invocation) {
-                String str = invocation.getArgumentAt(0, String.class);
-                Filter mockFilter = mock(Filter.class);
-                doReturn(str).when(mockFilter).toString();
-                return mockFilter;
-            }
-        }).when(mockedContext).createFilter(anyString());
-        doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
-
-        setupMockService(EventLoopGroup.class, mock(EventLoopGroup.class));
-        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
-        setupMockService(PCEPSessionProposalFactory.class, new BasePCEPSessionProposalFactory(120, 30,
-                Collections.emptyList()));
-    }
-
-    private void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
-        final ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
-        doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
-                getServiceReferences(anyString(), contains(serviceInterface.getName()));
-        doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
-                getServiceReferences(serviceInterface.getName(), null);
-        doReturn(instance).when(mockedContext).getService(mockServiceRef);
-    }
-
-    @Test
-    public void testValidationExceptionMaxUnknownMessagesNotSet() throws Exception {
-        try {
-            createDispatcherInstance(null);
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("MaxUnknownMessages value is not set"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionMaxUnknownMessagesMinValue() throws Exception {
-        try {
-            createDispatcherInstance(0);
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("must be greater than 0"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionCertificatePassword() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(null, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("certificate password"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionKeystoreLocation() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, null, STORE_PASSWORD, PathType.PATH, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("keystore location"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionKeystorePassword() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, null, PathType.PATH, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("keystore password"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionKeystorePathType() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, null, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("keystore path type"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionKeystoreType() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, null, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("keystore type"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionTruststoreLocation() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS, null, STORE_PASSWORD,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("truststore location"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionTruststorePassword() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS, TRUSTSTORE, null,
-                    PathType.PATH, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("truststore password"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionTruststorePathType() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    null, StoreType.JKS));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("truststore path type"));
-        }
-    }
-
-    @Test
-    public void testValidationExceptionTruststoreType() throws Exception {
-        try {
-            createDispatcherInstance(1, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS, TRUSTSTORE, STORE_PASSWORD,
-                    PathType.PATH, null));
-            fail();
-        } catch (final ValidationException e) {
-            assertTrue(e.getMessage().contains("truststore type"));
-        }
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        final CommitStatus status = createDispatcherInstance(5);
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 5, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createDispatcherInstance(5);
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        final CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 5);
-    }
-
-    @Test
-    public void testReconfigure() throws Exception {
-        createDispatcherInstance(5);
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        final PCEPDispatcherImplModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
-                PCEPDispatcherImplModuleMXBean.class);
-        mxBean.setMaxUnknownMessages(10);
-        final CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 1, 4);
-    }
-
-    @Test
-    public void testCreateBeanWithTls() throws Exception {
-        final CommitStatus status = createDispatcherInstance(5, createTls(STORE_PASSWORD, KEYSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS,
-                TRUSTSTORE, STORE_PASSWORD, PathType.PATH, StoreType.JKS));
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 5, 0, 0);
-    }
-
-    private CommitStatus createDispatcherInstance(final Integer maxUnknownMessages) throws Exception {
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        createDispatcherInstance(transaction, maxUnknownMessages);
-        return transaction.commit();
-    }
-
-    private CommitStatus createDispatcherInstance(final Integer maxUnknownMessages, final Tls tls) throws Exception {
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        createDispatcherInstance(transaction, maxUnknownMessages, tls);
-        return transaction.commit();
-    }
-
-    public static ObjectName createDispatcherInstance(final ConfigTransactionJMXClient transaction, final Integer maxUnknownMessages)
-            throws Exception {
-        final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-        final PCEPDispatcherImplModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, PCEPDispatcherImplModuleMXBean.class);
-        mxBean.setPcepSessionProposalFactory(createSessionProposalFactoryInstance(transaction));
-        mxBean.setMaxUnknownMessages(maxUnknownMessages);
-        mxBean.setBossGroup(createThreadGroupInstance(transaction, 10, BOSS_TG_INSTANCE_NAME));
-        mxBean.setWorkerGroup(createThreadGroupInstance(transaction, 10, WORKER_TG_INSTANCE_NAME));
-        mxBean.setPcepExtensions(createExtensionsInstance(transaction));
-        return nameCreated;
-    }
-
-    private static ObjectName createSessionProposalFactoryInstance(final ConfigTransactionJMXClient transaction)
-            throws InstanceAlreadyExistsException {
-        final ObjectName nameCreated = transaction.createModule(PCEPSessionProposalFactoryImplModuleFactory.NAME,
-                "pcep-session-proposal-factory-impl");
-        transaction.newMXBeanProxy(nameCreated, PCEPSessionProposalFactoryImplModuleMXBean.class);
-        return nameCreated;
-    }
-
-    private static ObjectName createDispatcherInstance(final ConfigTransactionJMXClient transaction, final Integer maxUnknownMessages,
-            final Tls tls) throws Exception {
-        final ObjectName objName = createDispatcherInstance(transaction, maxUnknownMessages);
-        final PCEPDispatcherImplModuleMXBean mxBean = transaction.newMXBeanProxy(objName, PCEPDispatcherImplModuleMXBean.class);
-        mxBean.setTls(tls);
-        return objName;
-    }
-
-    private static ObjectName createExtensionsInstance(final ConfigTransactionJMXClient transaction) throws InstanceAlreadyExistsException {
-        final ObjectName nameCreated = transaction.createModule(EXTENSION_FACTORYNAME, EXTENSION_INSTANCE_NAME);
-        transaction.newMXBeanProxy(nameCreated, SimplePCEPExtensionProviderContextModuleMXBean.class);
-
-        return nameCreated;
-    }
-
-    private static ObjectName createThreadGroupInstance(final ConfigTransactionJMXClient transaction, final Integer threadCount,
-            final String instanceName) throws InstanceAlreadyExistsException {
-        final ObjectName nameCreated = transaction.createModule(THREADGROUP_FACTORY_NAME, instanceName);
-        final NettyThreadgroupModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, NettyThreadgroupModuleMXBean.class);
-        mxBean.setThreadCount(threadCount);
-        return nameCreated;
-    }
-
-    private static Tls createTls(final String certificatePassword, final String keystore, final String keystorePassword,
-            final PathType keystorePathType, final StoreType keystoreType, final String truststore,
-            final String truststorePassword, final PathType truststorePathType, final StoreType truststoreType) {
-        final Tls tls = new Tls();
-        tls.setCertificatePassword(certificatePassword);
-        tls.setKeystore(keystore);
-        tls.setKeystorePassword(keystorePassword);
-        tls.setKeystorePathType(keystorePathType);
-        tls.setKeystoreType(keystoreType);
-        tls.setTruststore(truststore);
-        tls.setTruststorePassword(truststorePassword);
-        tls.setTruststorePathType(truststorePathType);
-        tls.setTruststoreType(truststoreType);
-        return tls;
-    }
-
-}
index 778b4d0dde81e0a42eb3d92930553846f58bc8da..b50b1a3df62fc474f958723a637e4c0568fb8b30 100644 (file)
@@ -9,16 +9,15 @@ package org.opendaylight.protocol.pcep.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-
 import io.netty.util.concurrent.DefaultPromise;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
 import org.opendaylight.protocol.pcep.impl.spi.Util;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr;
@@ -40,7 +39,7 @@ public class FiniteStateMachineTest extends AbstractPCEPSessionTest {
         this.serverSession = new DefaultPCEPSessionNegotiator(new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE),
                 this.channel, this.listener, (short) 1, 20, localPrefs);
         this.tlsSessionNegotiator = new DefaultPCEPSessionNegotiator(new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE),
-                this.channel, this.listener, (short) 1, 20, localPrefs, new Tls());
+                this.channel, this.listener, (short) 1, 20, localPrefs, new TlsBuilder().build());
     }
 
     /**
index 6eada3f2f03a122349ee3230c92e78c6f709448e..10f2301d102c1926d1c8cdce856457790a6a3e5c 100644 (file)
@@ -9,13 +9,13 @@
 package org.opendaylight.protocol.pcep.impl;
 
 import static org.junit.Assert.assertNotNull;
-
 import javax.net.ssl.SSLContext;
 import org.junit.Test;
-import org.opendaylight.controller.config.yang.pcep.impl.Tls;
 import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.PathType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.StoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.StoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
 
 public class SslContextFactoryTest {
 
@@ -27,17 +27,10 @@ public class SslContextFactoryTest {
     }
 
     public static Tls createTlsConfig() {
-        final Tls tlsConfig = new Tls();
-        tlsConfig.setCertificatePassword("opendaylight");
-        tlsConfig.setKeystore("/exemplary-ctlKeystore");
-        tlsConfig.setKeystorePassword("opendaylight");
-        tlsConfig.setKeystorePathType(PathType.CLASSPATH);
-        tlsConfig.setKeystoreType(StoreType.JKS);
-        tlsConfig.setTruststore("/exemplary-ctlTrustStore");
-        tlsConfig.setTruststorePassword("opendaylight");
-        tlsConfig.setTruststorePathType(PathType.CLASSPATH);
-        tlsConfig.setTruststoreType(StoreType.JKS);
-        return tlsConfig;
+        return new TlsBuilder().setCertificatePassword("opendaylight").setKeystore("/exemplary-ctlKeystore")
+                .setKeystorePassword("opendaylight").setKeystorePathType(PathType.CLASSPATH)
+                .setKeystoreType(StoreType.JKS).setTruststore("/exemplary-ctlTrustStore")
+                .setTruststorePassword("opendaylight").setTruststorePathType(PathType.CLASSPATH)
+                .setTruststoreType(StoreType.JKS).build();
     }
-
 }
index e2a1828ba63c961cffd090b5d46b9d184b774685..05178cb70824c76c922e4d5372ca5fada1424b28 100644 (file)
             <artifactId>concepts</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>config-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>yang-binding</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-common</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
 
         <!--test dependencies -->
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>config-manager</artifactId>
-            <type>test-jar</type>
-        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>config-manager</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>config-util</artifactId>
-        </dependency>
     </dependencies>
 
     <build>
                    </instructions>
                </configuration>
            </plugin>
-           <plugin>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-maven-plugin</artifactId>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
diff --git a/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java b/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java
deleted file mode 100644 (file)
index c0a2008..0000000
+++ /dev/null
@@ -1,69 +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: config-pcep-spi  yang module local name: pcep-extensions-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Mon Nov 18 14:32:53 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.spi;
-
-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.pcep.spi.PCEPExtensionProviderContext;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public final class SimplePCEPExtensionProviderContextModule extends AbstractSimplePCEPExtensionProviderContextModule {
-    private BundleContext bundleContext;
-
-    public SimplePCEPExtensionProviderContextModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public SimplePCEPExtensionProviderContextModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final SimplePCEPExtensionProviderContextModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public AutoCloseable createInstance() {
-        final WaitingServiceTracker<PCEPExtensionProviderContext> tracker =
-                WaitingServiceTracker.create(PCEPExtensionProviderContext.class, bundleContext);
-        final PCEPExtensionProviderContext service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-
-        return Reflection.newProxy(AutoCloseablePCEPExtensionProviderContext.class, new AbstractInvocationHandler() {
-            @Override
-            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
-                if (method.getName().equals("close")) {
-                    tracker.close();
-                    return null;
-                } else {
-                    return method.invoke(service, args);
-                }
-            }
-        });
-    }
-
-    void setBundleContext(BundleContext bundleContext) {
-        this.bundleContext = bundleContext;
-    }
-
-    private static interface AutoCloseablePCEPExtensionProviderContext extends PCEPExtensionProviderContext, AutoCloseable {
-    }
-}
diff --git a/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java b/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java
deleted file mode 100644 (file)
index 486c93d..0000000
+++ /dev/null
@@ -1,43 +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: config-pcep-spi  yang module local name: pcep-extensions-impl
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Mon Nov 18 14:32:53 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.spi;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-/**
- * @deprecated Replaced by blueprint wiring
- */
-@Deprecated
-public class SimplePCEPExtensionProviderContextModuleFactory extends AbstractSimplePCEPExtensionProviderContextModuleFactory {
-    @Override
-    public SimplePCEPExtensionProviderContextModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
-            SimplePCEPExtensionProviderContextModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
-        SimplePCEPExtensionProviderContextModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
-                oldInstance, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-
-    @Override
-    public SimplePCEPExtensionProviderContextModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
-            BundleContext bundleContext) {
-        SimplePCEPExtensionProviderContextModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-}
diff --git a/pcep/spi/src/main/yang/odl-pcep-spi-cfg.yang b/pcep/spi/src/main/yang/odl-pcep-spi-cfg.yang
deleted file mode 100644 (file)
index deadb72..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// vi: set smarttab et sw=4 tabstop=4:
-module odl-pcep-spi-cfg {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:spi";
-    prefix "spi";
-
-    import config { prefix config; revision-date 2013-04-05; }
-
-    organization "Cisco Systems, Inc.";
-
-    contact "Robert Varga <rovarga@cisco.com>";
-
-    description
-        "This module contains the base YANG definitions for
-        PCEP SPI module.
-
-        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 "2013-11-15" {
-        description
-            "Initial revision";
-    }
-
-    identity consumer-extensions {
-        description
-            "Service representing a PCEP parser extension registry. Extension
-            consumers have this service injected.";
-
-        base "config:service-type";
-        config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext";
-    }
-
-    identity extensions {
-        description
-            "Service representing a PCEP parser extension registry. Extension
-            providers have this service injected for registration.";
-
-        base "consumer-extensions";
-        config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext";
-    }
-
-    identity extension {
-        description
-            "Service representing a PCEP parser extension.";
-
-        base "config:service-type";
-        config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator";
-        config:disable-osgi-service-registration;
-    }
-
-    identity pcep-extensions-impl {
-        base config:module-type;
-        config:provided-service extensions;
-        config:java-name-prefix SimplePCEPExtensionProviderContext;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-extensions-impl {
-            when "/config:modules/config:module/config:type = 'pcep-extensions-impl'";
-        }
-    }
-}
-
index deb9da54cd0a918e7422e97f5cd80dbc832cca7b..e9b845ad1e4c5d4ea2b9cd95f5fc151919dd2fb1 100755 (executable)
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.bgpcep.pcep.topology.provider.PCEPTopologyProvider;
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleMXBean;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.protocol.concepts.KeyMapping;
index b66856d6a9f11314558168f04b61b2e584f538cf..4f090e66e378a7eb7b5fef172d97a2a4ff97383a 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.config.yang.pcep.topology.provider;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleTest.createDispatcherInstance;
+import io.netty.channel.nio.NioEventLoopGroup;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -23,11 +23,13 @@ import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
 import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.impl.PCEPSessionProposalFactoryImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
+import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleMXBean;
 import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
+import org.opendaylight.protocol.pcep.PCEPDispatcher;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
 import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
+import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
+import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -50,9 +52,14 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
     public void setUp() throws Exception {
         super.setUp();
 
-        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
-        setupMockService(PCEPSessionProposalFactory.class, new BasePCEPSessionProposalFactory(120, 30,
-                Collections.emptyList()));
+        SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext();
+        setupMockService(PCEPExtensionProviderContext.class, extContext);
+        BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30,
+                Collections.emptyList());
+        setupMockService(PCEPSessionProposalFactory.class, proposalFactory);
+        NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
+        setupMockService(PCEPDispatcher.class, new PCEPDispatcherImpl(extContext.getMessageHandlerRegistry(),
+                new DefaultPCEPSessionNegotiatorFactory(proposalFactory, 5), eventLoopGroup, eventLoopGroup));
     }
 
     @Test
@@ -89,7 +96,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
     public void testCreateBean() throws Exception {
         final CommitStatus status = createInstance(false);
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 17, 0, 0);
+        assertStatus(status, 13, 0, 0);
     }
 
     @Test
@@ -99,7 +106,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
         assertBeanCount(1, FACTORY_NAME);
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 17);
+        assertStatus(status, 0, 0, 13);
     }
 
     @Test
@@ -112,7 +119,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
         mxBean.setTopologyId(new TopologyId("new-pcep-topology"));
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 1, 16);
+        assertStatus(status, 0, 1, 12);
     }
 
     private CommitStatus createInstance(final String listenAddress, final PortNumber listenPort,
@@ -132,7 +139,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
         final ObjectName objectName = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
         final PCEPTopologyProviderModuleMXBean mxBean = transaction.newMXBeanProxy(objectName, PCEPTopologyProviderModuleMXBean.class);
         mxBean.setDataProvider(dataBrokerON);
-        mxBean.setDispatcher(createDispatcherInstance(transaction, 5));
+        mxBean.setDispatcher(createDispatcherInstance(transaction));
 
         mxBean.setListenAddress(new IpAddress(LISTEN_ADDRESS.toCharArray()));
         mxBean.setListenPort(getRandomPortNumber());
@@ -144,6 +151,13 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
         return objectName;
     }
 
+    public static ObjectName createDispatcherInstance(final ConfigTransactionJMXClient transaction)
+            throws Exception {
+        final ObjectName nameCreated = transaction.createModule(PCEPDispatcherImplModuleFactory.NAME, "pcep-dispatcher-impl");
+        transaction.newMXBeanProxy(nameCreated, PCEPDispatcherImplModuleMXBean.class);
+        return nameCreated;
+    }
+
     private ObjectName createPCEPTopologyProviderModuleInstance(final ConfigTransactionJMXClient transaction, final String listenAddress,
             final PortNumber listenPort, final TopologyId topologyId, final boolean addMD5) throws Exception {
         final ObjectName objectName = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
@@ -153,7 +167,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
 
         final PCEPTopologyProviderModuleMXBean mxBean = transaction.newMXBeanProxy(objectName, PCEPTopologyProviderModuleMXBean.class);
         mxBean.setDataProvider(asyncDataBrokerON);
-        mxBean.setDispatcher(createDispatcherInstance(transaction, 5));
+        mxBean.setDispatcher(createDispatcherInstance(transaction));
 
         if (addMD5) {
             // create 1 client
@@ -179,9 +193,7 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
         final List<ModuleFactory> moduleFactories = super.getModuleFactories();
         moduleFactories.add(new PCEPTopologyProviderModuleFactory());
         moduleFactories.add(new PCEPDispatcherImplModuleFactory());
-        moduleFactories.add(new PCEPSessionProposalFactoryImplModuleFactory());
         moduleFactories.add(new NettyThreadgroupModuleFactory());
-        moduleFactories.add(new SimplePCEPExtensionProviderContextModuleFactory());
         moduleFactories.add(new Stateful07TopologySessionListenerModuleFactory());
         return moduleFactories;
     }
index 265da64e9ed126638e90b1ae50f74754282c6738..f2e3acb961ca2e5c75090d71be41be3c53002c96 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.config.yang.pcep.tunnel.provider;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import io.netty.channel.nio.NioEventLoopGroup;
 import java.util.Collections;
 import java.util.List;
 import javax.management.ObjectName;
@@ -20,15 +21,16 @@ import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
 import org.opendaylight.controller.config.yang.pcep.impl.PCEPDispatcherImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.impl.PCEPSessionProposalFactoryImplModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
 import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleFactory;
 import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleMXBean;
 import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleTest;
 import org.opendaylight.controller.config.yang.pcep.topology.provider.Stateful07TopologySessionListenerModuleFactory;
 import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
+import org.opendaylight.protocol.pcep.PCEPDispatcher;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
 import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
+import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
+import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
@@ -45,9 +47,14 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
     public void setUp() throws Exception {
         super.setUp();
 
-        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
-        setupMockService(PCEPSessionProposalFactory.class, new BasePCEPSessionProposalFactory(120, 30,
-                Collections.emptyList()));
+        SimplePCEPExtensionProviderContext extContext = new SimplePCEPExtensionProviderContext();
+        setupMockService(PCEPExtensionProviderContext.class, extContext);
+        BasePCEPSessionProposalFactory proposalFactory = new BasePCEPSessionProposalFactory(120, 30,
+                Collections.emptyList());
+        setupMockService(PCEPSessionProposalFactory.class, proposalFactory);
+        NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
+        setupMockService(PCEPDispatcher.class, new PCEPDispatcherImpl(extContext.getMessageHandlerRegistry(),
+                new DefaultPCEPSessionNegotiatorFactory(proposalFactory, 5), eventLoopGroup, eventLoopGroup));
     }
 
     @Test
@@ -64,7 +71,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
     public void testCreateBean() throws Exception {
         final CommitStatus status = createInstance();
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 18, 0, 0);
+        assertStatus(status, 14, 0, 0);
     }
 
     @Test
@@ -74,7 +81,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
         assertBeanCount(1, FACTORY_NAME);
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 18);
+        assertStatus(status, 0, 0, 14);
     }
 
     @Test
@@ -87,7 +94,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
         mxBean.setTopologyId(new TopologyId("new-pcep-topology"));
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 1, 17);
+        assertStatus(status, 0, 1, 13);
     }
 
     private CommitStatus createInstance(final TopologyId topologyId) throws Exception {
@@ -128,9 +135,7 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
         moduleFactories.add(new PCEPTunnelTopologyProviderModuleFactory());
         moduleFactories.add(new PCEPTopologyProviderModuleFactory());
         moduleFactories.add(new PCEPDispatcherImplModuleFactory());
-        moduleFactories.add(new PCEPSessionProposalFactoryImplModuleFactory());
         moduleFactories.add(new NettyThreadgroupModuleFactory());
-        moduleFactories.add(new SimplePCEPExtensionProviderContextModuleFactory());
         moduleFactories.add(new Stateful07TopologySessionListenerModuleFactory());
         return moduleFactories;
     }