Convert PCEP extensions to blueprint 12/41512/7
authorTom Pantelis <tpanteli@brocade.com>
Thu, 7 Jul 2016 09:10:22 +0000 (05:10 -0400)
committerMilos Fabian <milfabia@cisco.com>
Tue, 19 Jul 2016 11:40:04 +0000 (11:40 +0000)
Added blueprint XML file, pcep-spi.xml, to the spi bundle that utilizes
the blueprint extension, "specific-reference-list" , to obtain the
specific list of PCEPExtensionProviderActivator OSGi service instances.
The specific expected services are announced via
META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator
resources in the provider bundles which the "specific-reference-list"
extension scan so it knows which services to look for. Once all expected
services are obtained, the PCEPExtensionProviderActivator instance List
bean is created and injected into the SimplePCEPExtensionProviderContextActivator
bean instance which calls start on each.

All 6 PCEPExtensionProviderActivator implementations, base-parser,
auto-bandwidth, segment-routing, and 3 in ietf-stateful07, now created via
new blueprint XML files and the corresponding config yang and associated Module
class were removed.

The SimplePCEPExtensionProviderContextModule was deprecated but still
remains for now to provide the PCEPExtensionProviderContext 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.

Change-Id: I71193376f762975f775d1a5a6cee0f7702b525b2
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
51 files changed:
artifacts/pom.xml
features/pcep/pom.xml
features/pcep/src/main/features/features.xml
pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModule.java [deleted file]
pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleFactory.java [deleted file]
pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/Activator.java
pcep/auto-bandwidth-extension/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator [new file with mode: 0644]
pcep/auto-bandwidth-extension/src/main/resources/org/opendaylight/blueprint/pcep-auto-bandwidth.xml [new file with mode: 0644]
pcep/auto-bandwidth-extension/src/main/yang/odl-pcep-auto-bandwidth-cfg.yang [deleted file]
pcep/auto-bandwidth-extension/src/main/yang/pcep-auto-bandwidth-app-config.yang [new file with mode: 0644]
pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleTest.java [deleted file]
pcep/base-parser/src/main/resources/org/opendaylight/blueprint/pcep-base-parser.xml [new file with mode: 0644]
pcep/controller-config/pom.xml
pcep/controller-config/src/main/resources/initial/32-pcep.xml
pcep/controller-config/src/main/resources/initial/33-pcep-segment-routing.xml
pcep/controller-config/src/main/resources/initial/34-pcep-auto-bandwidth.xml [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModule.java [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModuleFactory.java [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModule.java [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModuleFactory.java [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java [deleted file]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java [deleted file]
pcep/ietf-stateful07/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator
pcep/ietf-stateful07/src/main/resources/org/opendaylight/blueprint/pcep-ietf-stateful.xml [new file with mode: 0644]
pcep/ietf-stateful07/src/main/yang/odl-pcep-ietf-stateful07-cfg.yang
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfInitiated00PCEPParserModuleTest.java [deleted file]
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfStateful07PCEPParserModuleTest.java [deleted file]
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java [deleted file]
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModule.java [deleted file]
pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleFactory.java [deleted file]
pcep/impl/src/main/yang/odl-pcep-impl-cfg.yang
pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleTest.java [deleted file]
pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleTest.java
pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModule.java [deleted file]
pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleFactory.java [deleted file]
pcep/segment-routing/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator [new file with mode: 0644]
pcep/segment-routing/src/main/resources/org/opendaylight/blueprint/pcep-segment-routing.xml [new file with mode: 0644]
pcep/segment-routing/src/main/yang/odl-pcep-segment-routing-cfg.yang
pcep/segment-routing/src/main/yang/pcep-segment-routing-app-config.yang [new file with mode: 0644]
pcep/segment-routing/src/test/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleTest.java [deleted file]
pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContext.java [deleted file]
pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java
pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContextActivator.java [new file with mode: 0644]
pcep/spi/src/main/resources/org/opendaylight/blueprint/pcep-spi.xml [new file with mode: 0644]
pcep/spi/src/main/yang/odl-pcep-spi-cfg.yang
pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContextTest.java [deleted file]
pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleTest.java [deleted file]
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
programming/impl/src/test/java/org/opendaylight/controller/config/yang/programming/impl/AbstractInstructionSchedulerTest.java

index 33c256d594809b8835e3c255e22e116ca6b267be..ff85631e587ae01887c1b7020755ba609cb08caf 100644 (file)
                 <type>xml</type>
                 <classifier>config-segment</classifier>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>pcep-controller-config</artifactId>
-                <version>${project.version}</version>
-                <type>xml</type>
-                <classifier>config-auto-bw</classifier>
-            </dependency>
 
             <dependency>
                 <groupId>${project.groupId}</groupId>
index c53ded1a198d6ac4f1b7bb2bc58cf9681e8f353f..f2ef24a5632e3c6dabeb8b92578f5a05ffd5706f 100644 (file)
           <type>xml</type>
           <classifier>config-segment</classifier>
       </dependency>
-      <dependency>
-          <groupId>${project.groupId}</groupId>
-          <artifactId>pcep-controller-config</artifactId>
-          <type>xml</type>
-          <classifier>config-auto-bw</classifier>
-      </dependency>
       <dependency>
           <groupId>${project.groupId}</groupId>
           <artifactId>pcep-controller-config</artifactId>
index 6debc0d576b2e016fb1b2d90bdffdb5f2161d3e2..2d2128ddfde36e7e1708ff7d71ad21c0966563ad 100644 (file)
     <feature name='odl-bgpcep-pcep-auto-bandwidth' version='${project.version}'>
         <feature version='${project.version}'>odl-bgpcep-pcep-stateful07</feature>
         <bundle>mvn:org.opendaylight.bgpcep/pcep-auto-bandwidth-extension/{{VERSION}}</bundle>
-        <configfile finalname="etc/opendaylight/karaf/34-pcep-auto-bandwidth.xml">mvn:org.opendaylight.bgpcep/pcep-controller-config/{{VERSION}}/xml/config-auto-bw</configfile>
     </feature>
 </features>
diff --git a/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModule.java b/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModule.java
deleted file mode 100644 (file)
index c320f73..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator;
-
-public class AutoBandwidthPCEPParserModule extends AbstractAutoBandwidthPCEPParserModule {
-
-    private static final int BW_TYPE_RANGE_LOW = 3;
-    private static final int BW_TYPE_RANGE_UP = 15;
-
-    public AutoBandwidthPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AutoBandwidthPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver, final AutoBandwidthPCEPParserModule oldModule, final AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        //values 3-15 are unassigned - http://www.iana.org/assignments/pcep/pcep.xhtml#pcep-objects
-        JmxAttributeValidationException.checkCondition(getBandwidthUsageObjectType() >= BW_TYPE_RANGE_LOW &&
-                getBandwidthUsageObjectType() <= BW_TYPE_RANGE_UP, "out of range 3..15", bandwidthUsageObjectTypeJmxAttribute);
-    }
-
-    @Override
-    public AutoCloseable createInstance() {
-        return new Activator(getBandwidthUsageObjectType());
-    }
-
-}
diff --git a/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleFactory.java b/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleFactory.java
deleted file mode 100644 (file)
index 94d4ec5..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-public class AutoBandwidthPCEPParserModuleFactory extends AbstractAutoBandwidthPCEPParserModuleFactory {
-
-}
index 7123f30939f28e53da50ca00ecbe527868ef479d..f0b7435001af7df843f660e5eeecc6d38220021e 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.protocol.pcep.auto.bandwidth.extension;
 
+import com.google.common.annotations.VisibleForTesting;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
@@ -19,6 +20,11 @@ public class Activator extends AbstractPCEPExtensionProviderActivator {
 
     private final int bandwidthUsageObjectType;
 
+    @VisibleForTesting
+    public Activator() {
+        this(1);
+    }
+
     public Activator(final int bandwidthUsageObjectType) {
         this.bandwidthUsageObjectType = bandwidthUsageObjectType;
     }
diff --git a/pcep/auto-bandwidth-extension/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator b/pcep/auto-bandwidth-extension/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator
new file mode 100644 (file)
index 0000000..fa65d62
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (c) 2016 Brocade Communications 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
+org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator
diff --git a/pcep/auto-bandwidth-extension/src/main/resources/org/opendaylight/blueprint/pcep-auto-bandwidth.xml b/pcep/auto-bandwidth-extension/src/main/resources/org/opendaylight/blueprint/pcep-auto-bandwidth.xml
new file mode 100644 (file)
index 0000000..8b18856
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <odl:clustered-app-config id="autoBandwidthAppConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.app.config.rev160707.PcepAutoBandwidthAppConfig"/>
+
+  <bean id="autoBandwidthActivator" class="org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator">
+    <argument>
+      <bean factory-ref="autoBandwidthAppConfig" factory-method="getBandwidthUsageObjectType"/>
+    </argument>
+  </bean>
+
+  <service ref="autoBandwidthActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator"/>
+</blueprint>
\ No newline at end of file
diff --git a/pcep/auto-bandwidth-extension/src/main/yang/odl-pcep-auto-bandwidth-cfg.yang b/pcep/auto-bandwidth-extension/src/main/yang/odl-pcep-auto-bandwidth-cfg.yang
deleted file mode 100644 (file)
index c92bb09..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-module odl-pcep-auto-bandwidth-cfg {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:auto:bandwidth:cfg";
-    prefix "auto-bw-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; }
-
-    organization "Cisco Systems, Inc.";
-
-    contact "Milos Fabian <milfabia@cisco.com>";
-
-    description
-        "This module contains the base YANG definitions for
-         draft-ietf-pce-stateful-pce-07 extensions configuration.
-
-        Copyright (c)2016 Cisco Systems, Inc. All rights reserved.;
-
-        This program and the accompanying materials are made available
-        under the terms of the Eclipse Public License v1.0 which
-        accompanies this distribution, and is available at
-        http://www.eclipse.org/legal/epl-v10.html";
-
-    revision 2016-01-09 {
-        description "Initial revision";
-    }
-
-    identity pcep-parser-auto-bandwidth {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix AutoBandwidthPCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-auto-bandwidth {
-            when "/config:modules/config:module/config:type = 'pcep-parser-auto-bandwidth'";
-            leaf bandwidth-usage-object-type {
-                type uint8;
-                default 5;
-            }
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/pcep/auto-bandwidth-extension/src/main/yang/pcep-auto-bandwidth-app-config.yang b/pcep/auto-bandwidth-extension/src/main/yang/pcep-auto-bandwidth-app-config.yang
new file mode 100644 (file)
index 0000000..469e17c
--- /dev/null
@@ -0,0 +1,23 @@
+module pcep-auto-bandwidth-app-config {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:auto-bandwidth-app-config";
+    prefix "pcep-auto-bandwidth-app-config";
+
+    description
+      "Configuration for the PCEP auto bandwidth extension.";
+
+    revision "2016-07-07" {
+        description
+            "Initial revision.";
+    }
+
+    container pcep-auto-bandwidth-app-config {
+        leaf bandwidth-usage-object-type {
+            type uint16 {
+                range "3..15";
+            }
+
+            default 5;
+        }
+    }
+}
\ No newline at end of file
diff --git a/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleTest.java b/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/controller/config/yang/pcep/auto/bandwidth/cfg/AutoBandwidthPCEPParserModuleTest.java
deleted file mode 100644 (file)
index 045f22f..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator;
-
-public class AutoBandwidthPCEPParserModuleTest {
-
-    private static final AutoBandwidthPCEPParserModuleFactory FACTORY = new AutoBandwidthPCEPParserModuleFactory();
-
-    private AutoBandwidthPCEPParserModule module;
-
-    @Before
-    public void setUp() {
-        final DependencyResolver dependencyResolver = Mockito.mock(DependencyResolver.class);
-        this.module = (AutoBandwidthPCEPParserModule) FACTORY.createModule("instance", dependencyResolver, null);
-    }
-
-    @Test
-    public void testCreateInsatnce() {
-        final AutoCloseable instance = module.createInstance();
-        Assert.assertTrue(instance instanceof Activator);
-    }
-
-    @Test
-    public void testCustomValidationLowerBound() {
-        try  {
-            this.module.setBandwidthUsageObjectType((short) 3);
-            this.module.customValidation();
-        } catch (final JmxAttributeValidationException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            this.module.setBandwidthUsageObjectType((short) 2);
-            this.module.customValidation();
-            Assert.fail();
-        } catch (final JmxAttributeValidationException e) {
-            Assert.assertTrue(e.getMessage().startsWith("BandwidthUsageObjectType out of range"));
-        }
-
-    }
-
-    @Test
-    public void testCustomValidationUpperBound() {
-        try  {
-            this.module.setBandwidthUsageObjectType((short) 15);
-            this.module.customValidation();
-        } catch (final JmxAttributeValidationException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            this.module.setBandwidthUsageObjectType((short) 16);
-            this.module.customValidation();
-            Assert.fail();
-        } catch (final JmxAttributeValidationException e) {
-            Assert.assertTrue(e.getMessage().startsWith("BandwidthUsageObjectType out of range"));
-        }
-
-    }
-
-}
diff --git a/pcep/base-parser/src/main/resources/org/opendaylight/blueprint/pcep-base-parser.xml b/pcep/base-parser/src/main/resources/org/opendaylight/blueprint/pcep-base-parser.xml
new file mode 100644 (file)
index 0000000..462f37f
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <bean id="baseParserActivator" class="org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator"/>
+
+  <service ref="baseParserActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator"/>
+</blueprint>
\ No newline at end of file
index e80df0a12b7a0bbc22fa87da1b9240f3e2df22f2..7ffc71900f9b7df8725255152d401c1975a5ffe7 100644 (file)
                                     <type>xml</type>
                                     <classifier>config-segment</classifier>
                                 </artifact>
-                                <artifact>
-                                    <file>${project.build.directory}/classes/initial/34-pcep-auto-bandwidth.xml</file>
-                                    <type>xml</type>
-                                    <classifier>config-auto-bw</classifier>
-                                </artifact>
                                 <artifact>
                                     <file>${project.build.directory}/classes/initial/39-pcep-provider.xml</file>
                                     <type>xml</type>
index 7f65c6a34e381293fce8b8e6d62a0e21b4a48b24..b581c6700d13322cc62f7d74873c8184e2d5e862 100644 (file)
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
                     <name>global-pcep-extensions</name>
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-base</name>
-                    </extension>
-
-                    <!-- This block is draft-ietf-pce-stateful-pce-07 + draft-ietf-pce-inititated-pce-00 -->
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-ietf-stateful07</name>
-                    </extension>
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-ietf-initiated00</name>
-                    </extension>
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-sync-optimizations</name>
-                    </extension>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">prefix:pcep-parser-base</type>
-                    <name>pcep-parser-base</name>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-ietf-stateful07</type>
-                    <name>pcep-parser-ietf-stateful07</name>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-ietf-initiated00</type>
-                    <name>pcep-parser-ietf-initiated00</name>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-sync-optimizations</type>
-                    <name>pcep-parser-sync-optimizations</name>
                 </module>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:stateful-capability</type>
                         <provider>/config/modules/module[name='pcep-extensions-impl']/instance[name='global-pcep-extensions']</provider>
                     </instance>
                 </service>
-                <service>
-                    <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                    <instance>
-                        <name>pcep-parser-base</name>
-                        <provider>/config/modules/module[name='pcep-parser-base']/instance[name='pcep-parser-base']</provider>
-                    </instance>
-                    <instance>
-                        <name>pcep-parser-ietf-initiated00</name>
-                        <provider>/config/modules/module[name='pcep-parser-ietf-initiated00']/instance[name='pcep-parser-ietf-initiated00']</provider>
-                    </instance>
-                    <instance>
-                        <name>pcep-parser-ietf-stateful07</name>
-                        <provider>/config/modules/module[name='pcep-parser-ietf-stateful07']/instance[name='pcep-parser-ietf-stateful07']</provider>
-                    </instance>
-                    <instance>
-                        <name>pcep-parser-sync-optimizations</name>
-                        <provider>/config/modules/module[name='pcep-parser-sync-optimizations']/instance[name='pcep-parser-sync-optimizations']</provider>
-                    </instance>
-                </service>
                 <service>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep">prefix:pcep-capability</type>
                     <instance>
index 5b704b6a5c931a835903984a671a9f8cbd7a3ef2..cd1020f1dbdb3a62930e56dc2e7da9c7419f4472 100644 (file)
@@ -9,21 +9,6 @@
     <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>
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-segment-routing</name>
-                    </extension>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr:cfg">prefix:pcep-parser-segment-routing</type>
-                    <name>pcep-parser-segment-routing</name>
-                    <!-- Proposed code point for SR-ERO/RRO subobject by draft (=36) https://tools.ietf.org/html/draft-ietf-pce-segment-routing-06.
-                     to preserve (TYPE = 5/6) assigned type set the value to false or remove (false by default) or set true to use proposed ones
-                    <iana-sr-subobjects-type>true</iana-sr-subobjects-type>-->
-                </module>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr:cfg">prefix:pcep-segment-routing-capability</type>
                     <name>pcep-segment-routing-capability</name>
                 </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:extension</type>
-                    <instance>
-                        <name>pcep-parser-segment-routing</name>
-                        <provider>/config/modules/module[name='pcep-parser-segment-routing']/instance[name='pcep-parser-segment-routing']</provider>
-                    </instance>
-                </service>
                 <service>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep">prefix:pcep-capability</type>
                     <instance>
diff --git a/pcep/controller-config/src/main/resources/initial/34-pcep-auto-bandwidth.xml b/pcep/controller-config/src/main/resources/initial/34-pcep-auto-bandwidth.xml
deleted file mode 100644 (file)
index 5fa5ad8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<snapshot>
-    <required-capabilities>
-        <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:pcep:auto:bandwidth:cfg?module=odl-pcep-auto-bandwidth-cfg&amp;revision=2016-01-09</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>
-                    <extension>
-                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
-                        <name>pcep-parser-auto-bandwidth</name>
-                    </extension>
-                </module>
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:auto:bandwidth:cfg">prefix:pcep-parser-auto-bandwidth</type>
-                    <name>pcep-parser-auto-bandwidth</name>
-                    <!--<bandwidth-usage-object-type>5</bandwidth-usage-object-type>-->
-                </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:extension</type>
-                    <instance>
-                        <name>pcep-parser-auto-bandwidth</name>
-                        <provider>/config/modules/module[name='pcep-parser-auto-bandwidth']/instance[name='pcep-parser-auto-bandwidth']</provider>
-                    </instance>
-                </service>
-           </services>
-        </data>
-    </configuration>
-</snapshot>
\ No newline at end of file
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModule.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModule.java
deleted file mode 100644 (file)
index dfd7b43..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg  yang module local name: pcep-parser-ietf-initiated00
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-import org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator;
-
-/**
-*
-*/
-public final class IetfInitiated00PCEPParserModule extends
-    org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfInitiated00PCEPParserModule {
-
-    public IetfInitiated00PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public IetfInitiated00PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final IetfInitiated00PCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
-
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new CrabbeInitiatedActivator();
-    }
-}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModuleFactory.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfInitiated00PCEPParserModuleFactory.java
deleted file mode 100644 (file)
index 603ba04..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg  yang module local name: pcep-parser-ietf-initiated00
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-/**
-*
-*/
-public class IetfInitiated00PCEPParserModuleFactory extends
-    org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfInitiated00PCEPParserModuleFactory {
-
-}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModule.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModule.java
deleted file mode 100644 (file)
index 74c15ee..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg  yang module local name: pcep-parser-ietf-stateful07
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-import org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator;
-
-/**
-*
-*/
-public final class IetfStateful07PCEPParserModule extends
-    org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfStateful07PCEPParserModule {
-
-    public IetfStateful07PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public IetfStateful07PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final IetfStateful07PCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
-
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new StatefulActivator();
-    }
-}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModuleFactory.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/IetfStateful07PCEPParserModuleFactory.java
deleted file mode 100644 (file)
index c188cb0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg  yang module local name: pcep-parser-ietf-stateful07
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-/**
-*
-*/
-public class IetfStateful07PCEPParserModuleFactory extends
-    org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfStateful07PCEPParserModuleFactory {
-
-}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java
deleted file mode 100644 (file)
index 5806771..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2015 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.stateful07.cfg;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
-
-public class SyncOptimizationsPCEPParserModule extends AbstractSyncOptimizationsPCEPParserModule {
-
-    public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
-        final SyncOptimizationsPCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    protected AutoCloseable createInstance() {
-        return new SyncOptimizationsActivator();
-    }
-
-}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java
deleted file mode 100644 (file)
index 0b0c8ea..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (c) 2015 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.stateful07.cfg;
-
-public class SyncOptimizationsPCEPParserModuleFactory extends AbstractSyncOptimizationsPCEPParserModuleFactory {
-
-}
index 20b6f0bebf074578e565c6f1a3eb5da325ad54be..57a26e998c809a89bb8d6755c1f49f3f6ee2514f 100644 (file)
@@ -1,2 +1,3 @@
 org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator
 org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator
+org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator
diff --git a/pcep/ietf-stateful07/src/main/resources/org/opendaylight/blueprint/pcep-ietf-stateful.xml b/pcep/ietf-stateful07/src/main/resources/org/opendaylight/blueprint/pcep-ietf-stateful.xml
new file mode 100644 (file)
index 0000000..df00c1e
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <bean id="ietfStateful07Activator" class="org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator"/>
+  <service ref="ietfStateful07Activator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator"/>
+
+  <bean id="ietfInitiated00Activator" class="org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator"/>
+  <service ref="ietfInitiated00Activator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator"/>
+
+  <bean id="syncOptimizationsActivator" class="org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator"/>
+  <service ref="syncOptimizationsActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator"/>
+</blueprint>
\ No newline at end of file
index 41843a1322e35c590596e3c45003ebc88371977f..8088bfb08b94c536e32ead696ca6343c0605c6f8 100644 (file)
@@ -92,41 +92,5 @@ module odl-pcep-ietf-stateful07-cfg {
             uses stateful-capabilities;
         }
     }
-
-    identity pcep-parser-ietf-stateful07 {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix IetfStateful07PCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-ietf-stateful07 {
-            when "/config:modules/config:module/config:type = 'pcep-parser-ietf-stateful07'";
-        }
-    }
-
-    identity pcep-parser-ietf-initiated00 {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix IetfInitiated00PCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-ietf-initiated00 {
-            when "/config:modules/config:module/config:type = 'pcep-parser-ietf-initiated00'";
-        }
-    }
-
-    identity pcep-parser-sync-optimizations {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix SyncOptimizationsPCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-sync-optimizations {
-            when "/config:modules/config:module/config:type = 'pcep-parser-sync-optimizations'";
-        }
-    }
 }
 
diff --git a/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfInitiated00PCEPParserModuleTest.java b/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfInitiated00PCEPParserModuleTest.java
deleted file mode 100644 (file)
index 9b1e2f8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-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.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.IetfInitiated00PCEPParserModuleFactory;
-
-public class IetfInitiated00PCEPParserModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = IetfInitiated00PCEPParserModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-parser-ietf-initiated00-instance";
-
-    @Before
-    public void setUp() {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new IetfInitiated00PCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        CommitStatus status = createIetfInitiated00PCEPParserModuleInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 2, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createIetfInitiated00PCEPParserModuleInstance();
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 2);
-    }
-
-    private CommitStatus createIetfInitiated00PCEPParserModuleInstance() throws Exception {
-        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
-        SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
-        return transaction.commit();
-    }
-
-}
diff --git a/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfStateful07PCEPParserModuleTest.java b/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/IetfStateful07PCEPParserModuleTest.java
deleted file mode 100644 (file)
index f9c273e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-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.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.IetfStateful07PCEPParserModuleFactory;
-
-public class IetfStateful07PCEPParserModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = IetfStateful07PCEPParserModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-parser-ietf-stateful07-instance";
-
-    @Before
-    public void setUp() {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new IetfStateful07PCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        CommitStatus status = createStateful07PCEPParserModuleInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 2, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createStateful07PCEPParserModuleInstance();
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 2);
-    }
-
-    private CommitStatus createStateful07PCEPParserModuleInstance() throws Exception {
-        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
-        SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
-        return transaction.commit();
-    }
-
-}
diff --git a/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java b/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java
deleted file mode 100644 (file)
index 7129085..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2015 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.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-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.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.SyncOptimizationsPCEPParserModuleFactory;
-
-public class SyncOptimizationsPCEPParserModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = SyncOptimizationsPCEPParserModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-parser-sync-optimizations-instance";
-
-    @Before
-    public void setUp() {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new SyncOptimizationsPCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        final CommitStatus status = createSyncOptimizationsPCEPParserModuleInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 2, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createSyncOptimizationsPCEPParserModuleInstance();
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        final CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 2);
-    }
-
-    private CommitStatus createSyncOptimizationsPCEPParserModuleInstance() throws Exception {
-        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
-        SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
-        return transaction.commit();
-    }
-}
diff --git a/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModule.java b/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModule.java
deleted file mode 100644 (file)
index 877ce03..0000000
+++ /dev/null
@@ -1,42 +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: odl-pcep-impl-cfg  yang module local name: pcep-parser-base
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Tue Dec 03 09:34:06 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.protocol.pcep.parser.BaseParserExtensionActivator;
-
-/**
- *
- */
-public final class BasePCEPParserModule extends org.opendaylight.controller.config.yang.pcep.impl.AbstractBasePCEPParserModule {
-
-    public BasePCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public BasePCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BasePCEPParserModule oldModule,
-            final java.lang.AutoCloseable oldInstance) {
-
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new BaseParserExtensionActivator();
-    }
-}
diff --git a/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleFactory.java b/pcep/impl/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleFactory.java
deleted file mode 100644 (file)
index 38c8e4c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg  yang module local name: pcep-parser-base
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Tue Dec 03 09:34:06 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-/**
-*
-*/
-public class BasePCEPParserModuleFactory extends org.opendaylight.controller.config.yang.pcep.impl.AbstractBasePCEPParserModuleFactory {
-
-}
index 3ed427d3a5599c173823cd6e2f050573acb6f12a..93dd1860f7e99b21f00f7e3a61ff78bf342cc8d0 100644 (file)
@@ -48,18 +48,6 @@ module odl-pcep-impl-cfg {
         }
     }
 
-    identity pcep-parser-base {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix BasePCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-base {
-            when "/config:modules/config:module/config:type = 'pcep-parser-base'";
-        }
-    }
-
     identity pcep-dispatcher-impl {
         base config:module-type;
         config:provided-service pcep:pcep-dispatcher;
diff --git a/pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleTest.java b/pcep/impl/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/BasePCEPParserModuleTest.java
deleted file mode 100644 (file)
index 315f519..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-import com.google.common.collect.Lists;
-
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-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.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-
-public class BasePCEPParserModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = BasePCEPParserModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-parser-base-instance";
-
-    @Before
-    public void setUp() {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new BasePCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        CommitStatus status = createBasePCEPParserModuleInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 2, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createBasePCEPParserModuleInstance();
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 2);
-    }
-
-    private CommitStatus createBasePCEPParserModuleInstance() throws Exception {
-        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
-        SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
-        return transaction.commit();
-    }
-}
index 993da73c6be211e2a650e852b8e0776f59dbab69..e97a0fc5df28d630e70cd5400cc106192ad22a67 100644 (file)
@@ -32,6 +32,8 @@ import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgrou
 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.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;
@@ -69,14 +71,17 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
         }).when(mockedContext).createFilter(anyString());
         doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
 
-        setupMockService(EventLoopGroup.class);
+        setupMockService(EventLoopGroup.class, mock(EventLoopGroup.class));
+        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
     }
 
-    private void setupMockService(Class<?> serviceInterface) throws Exception {
-        ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
+    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(mock(serviceInterface)).when(mockedContext).getService(mockServiceRef);
+        doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
+                getServiceReferences(serviceInterface.getName(), null);
+        doReturn(instance).when(mockedContext).getService(mockServiceRef);
     }
 
     @Test
diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModule.java b/pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModule.java
deleted file mode 100644 (file)
index 17ec55a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.pcep.sr.cfg;
-
-import org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator;
-
-public class SegmentRoutingPCEPParserModule extends org.opendaylight.controller.config.yang.pcep.sr.cfg.AbstractSegmentRoutingPCEPParserModule {
-    public SegmentRoutingPCEPParserModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public SegmentRoutingPCEPParserModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.pcep.sr.cfg.SegmentRoutingPCEPParserModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new SegmentRoutingActivator(getIanaSrSubobjectsType());
-    }
-
-}
diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleFactory.java b/pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleFactory.java
deleted file mode 100644 (file)
index dd0f0ba..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.pcep.sr.cfg;
-public class SegmentRoutingPCEPParserModuleFactory extends org.opendaylight.controller.config.yang.pcep.sr.cfg.AbstractSegmentRoutingPCEPParserModuleFactory {
-
-}
diff --git a/pcep/segment-routing/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator b/pcep/segment-routing/src/main/resources/META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator
new file mode 100644 (file)
index 0000000..18d98b1
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (c) 2016 Brocade Communications 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
+org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator
diff --git a/pcep/segment-routing/src/main/resources/org/opendaylight/blueprint/pcep-segment-routing.xml b/pcep/segment-routing/src/main/resources/org/opendaylight/blueprint/pcep-segment-routing.xml
new file mode 100644 (file)
index 0000000..29f7aa2
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <odl:clustered-app-config id="segmentRoutingAppConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.segment.routing.app.config.rev160707.PcepSegmentRoutingAppConfig"/>
+
+  <bean id="segmentRoutingActivator" class="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator">
+    <argument>
+      <bean factory-ref="segmentRoutingAppConfig" factory-method="isIanaSrSubobjectsType"/>
+    </argument>
+  </bean>
+
+  <service ref="segmentRoutingActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+          odl:type="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator"/>
+</blueprint>
\ No newline at end of file
index d49b37fbcdda7b748c9db4d63dd20b0e574642ce..6e2e3f5f07752389447659a6ed7da476ce2ba25a 100644 (file)
@@ -29,24 +29,6 @@ module odl-pcep-segment-routing-cfg {
             "Initial revision.";
     }
 
-    identity pcep-parser-segment-routing {
-        base config:module-type;
-        config:provided-service spi:extension;
-        config:java-name-prefix SegmentRoutingPCEPParser;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case pcep-parser-segment-routing {
-            when "/config:modules/config:module/config:type = 'pcep-parser-segment-routing'";
-            leaf iana-sr-subobjects-type {
-                description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
-                    else proposed type (36) is used for parsing/serialization";
-                type boolean;
-                default false;
-            }
-        }
-    }
-
     identity pcep-segment-routing-capability {
         base config:module-type;
         config:java-name-prefix "PCEPSegmentRoutingCapability";
diff --git a/pcep/segment-routing/src/main/yang/pcep-segment-routing-app-config.yang b/pcep/segment-routing/src/main/yang/pcep-segment-routing-app-config.yang
new file mode 100644 (file)
index 0000000..6330cf0
--- /dev/null
@@ -0,0 +1,22 @@
+module pcep-segment-routing-app-config {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config";
+    prefix "pcep-segment-routing-app-config";
+
+    description
+      "Configuration for the PCEP segment routing extension.";
+
+    revision "2016-07-07" {
+        description
+            "Initial revision.";
+    }
+
+    container pcep-segment-routing-app-config {
+        leaf iana-sr-subobjects-type {
+            description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
+                    else proposed type (36) is used for parsing/serialization";
+            type boolean;
+            default false;
+        }
+    }
+}
\ No newline at end of file
diff --git a/pcep/segment-routing/src/test/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleTest.java b/pcep/segment-routing/src/test/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SegmentRoutingPCEPParserModuleTest.java
deleted file mode 100644 (file)
index 3b2582d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.config.yang.pcep.sr.cfg;
-
-import static org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-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.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-
-public class SegmentRoutingPCEPParserModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = SegmentRoutingPCEPParserModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-parser-sr02-instance";
-
-    @Before
-    public void setUp() {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new SegmentRoutingPCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        final CommitStatus status = createSrPCEPParserModuleInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 2, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createSrPCEPParserModuleInstance();
-        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        final CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 2);
-    }
-
-    private CommitStatus createSrPCEPParserModuleInstance() throws Exception {
-        final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        final ObjectName srParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
-        createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(srParserON));
-        return transaction.commit();
-    }
-}
diff --git a/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContext.java b/pcep/spi/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContext.java
deleted file mode 100644 (file)
index 782cb2e..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.pcep.spi;
-
-import java.util.List;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
-import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
-import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.ObjectParser;
-import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvRegistry;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.pcep.spi.VendorInformationObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.EnterpriseSpecificInformation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
-
-public class ReusablePCEPExtensionProviderContext implements AutoCloseable, PCEPExtensionProviderContext {
-    private final PCEPExtensionProviderContext delegate = new SimplePCEPExtensionProviderContext();
-    private List<PCEPExtensionProviderActivator> currentExtensionDependency;
-
-    @Override
-    public void close() {
-        for (final PCEPExtensionProviderActivator e : this.currentExtensionDependency) {
-            e.stop();
-        }
-    }
-
-    public void start(final List<PCEPExtensionProviderActivator> extensionDependency) {
-        for (final PCEPExtensionProviderActivator e : extensionDependency) {
-            e.start(this.delegate);
-        }
-        this.currentExtensionDependency = extensionDependency;
-    }
-
-    public void reconfigure(final List<PCEPExtensionProviderActivator> extensionDependency) {
-        // Shutdown old ones first
-        for (final PCEPExtensionProviderActivator e : this.currentExtensionDependency) {
-            if (!extensionDependency.contains(e)) {
-                e.stop();
-            }
-        }
-        // Start new ones
-        for (final PCEPExtensionProviderActivator e : extensionDependency) {
-            if (!this.currentExtensionDependency.contains(e)) {
-                e.start(this.delegate);
-            }
-        }
-        this.currentExtensionDependency = extensionDependency;
-    }
-
-    @Override
-    public LabelRegistry getLabelHandlerRegistry() {
-        return this.delegate.getLabelHandlerRegistry();
-    }
-
-    @Override
-    public MessageRegistry getMessageHandlerRegistry() {
-        return this.delegate.getMessageHandlerRegistry();
-    }
-
-    @Override
-    public ObjectRegistry getObjectHandlerRegistry() {
-        return this.delegate.getObjectHandlerRegistry();
-    }
-
-    @Override
-    public EROSubobjectRegistry getEROSubobjectHandlerRegistry() {
-        return this.delegate.getEROSubobjectHandlerRegistry();
-    }
-
-    @Override
-    public RROSubobjectRegistry getRROSubobjectHandlerRegistry() {
-        return this.delegate.getRROSubobjectHandlerRegistry();
-    }
-
-    @Override
-    public XROSubobjectRegistry getXROSubobjectHandlerRegistry() {
-        return this.delegate.getXROSubobjectHandlerRegistry();
-    }
-
-    @Override
-    public TlvRegistry getTlvHandlerRegistry() {
-        return this.delegate.getTlvHandlerRegistry();
-    }
-
-    @Override
-    public VendorInformationTlvRegistry getVendorInformationTlvRegistry() {
-        return this.delegate.getVendorInformationTlvRegistry();
-    }
-
-    @Override
-    public VendorInformationObjectRegistry getVendorInformationObjectRegistry() {
-        return this.delegate.getVendorInformationObjectRegistry();
-    }
-
-    @Override
-    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
-        return this.delegate.registerLabelSerializer(labelClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
-        return this.delegate.registerLabelParser(cType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerEROSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
-        return this.delegate.registerEROSubobjectParser(subobjectType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerEROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
-            final EROSubobjectSerializer serializer) {
-        return this.delegate.registerEROSubobjectSerializer(subobjectClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
-        return this.delegate.registerMessageParser(messageType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
-        return this.delegate.registerMessageSerializer(msgClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
-        return this.delegate.registerObjectParser(objectClass, objectType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
-        return this.delegate.registerObjectSerializer(objClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerRROSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
-        return this.delegate.registerRROSubobjectParser(subobjectType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerRROSubobjectSerializer(
-            final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
-            final RROSubobjectSerializer serializer) {
-        return this.delegate.registerRROSubobjectSerializer(subobjectClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass, final TlvSerializer serializer) {
-        return this.delegate.registerTlvSerializer(tlvClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerTlvParser(final int tlvType, final TlvParser parser) {
-        return this.delegate.registerTlvParser(tlvType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerVendorInformationTlvSerializer(
-            final Class<? extends EnterpriseSpecificInformation> esInformationClass, final TlvSerializer serializer) {
-        return this.delegate.registerVendorInformationTlvSerializer(esInformationClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber, final TlvParser parser) {
-        return this.delegate.registerVendorInformationTlvParser(enterpriseNumber, parser);
-    }
-
-    @Override
-    public AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
-            final XROSubobjectSerializer serializer) {
-        return this.delegate.registerXROSubobjectSerializer(subobjectClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerXROSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
-        return this.delegate.registerXROSubobjectParser(subobjectType, parser);
-    }
-
-    @Override
-    public AutoCloseable registerVendorInformationObjectSerializer(
-            final Class<? extends EnterpriseSpecificInformation> esInformationClass, final ObjectSerializer serializer) {
-        return this.delegate.registerVendorInformationObjectSerializer(esInformationClass, serializer);
-    }
-
-    @Override
-    public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber, final ObjectParser parser) {
-        return this.delegate.registerVendorInformationObjectParser(enterpriseNumber, parser);
-    }
-}
index ce878e66d61b062243df736c4b06aee285b821f0..c0a200864ca9382e3c9a72e67b0f7c2c39c70359 100644 (file)
  */
 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
  */
-public final class SimplePCEPExtensionProviderContextModule extends
-        org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModule {
+@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) {
@@ -35,21 +42,28 @@ public final class SimplePCEPExtensionProviderContextModule extends
     }
 
     @Override
-    public boolean canReuseInstance(final AbstractSimplePCEPExtensionProviderContextModule oldModule) {
-        return oldModule.getInstance().getClass().equals(ReusablePCEPExtensionProviderContext.class);
+    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);
+                }
+            }
+        });
     }
 
-    @Override
-    public java.lang.AutoCloseable reuseInstance(final java.lang.AutoCloseable oldInstance) {
-        final ReusablePCEPExtensionProviderContext ctx = (ReusablePCEPExtensionProviderContext) oldInstance;
-        ctx.reconfigure(getExtensionDependency());
-        return ctx;
+    void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
     }
 
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        final ReusablePCEPExtensionProviderContext ctx = new ReusablePCEPExtensionProviderContext();
-        ctx.start(getExtensionDependency());
-        return ctx;
+    private static interface AutoCloseablePCEPExtensionProviderContext extends PCEPExtensionProviderContext, AutoCloseable {
     }
 }
index c720e8f68bce5ed046fce22cdb0cf431c4d48b39..486c93dea4ff96e72181cc1f94078d5ceb04a135 100644 (file)
  */
 package org.opendaylight.controller.config.yang.pcep.spi;
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
 /**
-*
-*/
-public class SimplePCEPExtensionProviderContextModuleFactory extends
-        org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModuleFactory {
+ * @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/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContextActivator.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContextActivator.java
new file mode 100644 (file)
index 0000000..829331d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016 Brocade Communications 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.protocol.pcep.spi.pojo;
+
+import com.google.common.base.Preconditions;
+import java.util.List;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *  Starts and stops PCEPExtensionProviderActivator instances for a PCEPExtensionProviderContext.
+ *
+ * @author Thomas Pantelis
+ */
+public class SimplePCEPExtensionProviderContextActivator implements AutoCloseable {
+    private static final Logger LOG = LoggerFactory.getLogger(SimplePCEPExtensionProviderContextActivator.class);
+
+    private final PCEPExtensionProviderContext providerContext;
+    private final List<PCEPExtensionProviderActivator> extensionActivators;
+
+    public SimplePCEPExtensionProviderContextActivator(final PCEPExtensionProviderContext providerContext,
+            final List<PCEPExtensionProviderActivator> extensionActivators) {
+        this.providerContext = Preconditions.checkNotNull(providerContext);
+        this.extensionActivators = Preconditions.checkNotNull(extensionActivators);
+    }
+
+    public void start() {
+        LOG.debug("Starting {} PCEPExtensionProviderActivator instances", extensionActivators.size());
+
+        for(final PCEPExtensionProviderActivator e : extensionActivators) {
+            e.start(providerContext);
+        }
+    }
+
+    @Override
+    public void close() {
+        LOG.debug("Stopping {} BGPExtensionProviderActivator instances", extensionActivators.size());
+
+        for(final PCEPExtensionProviderActivator e : extensionActivators) {
+            e.stop();
+        }
+    }
+}
diff --git a/pcep/spi/src/main/resources/org/opendaylight/blueprint/pcep-spi.xml b/pcep/spi/src/main/resources/org/opendaylight/blueprint/pcep-spi.xml
new file mode 100644 (file)
index 0000000..1f02f95
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <!-- Obtains the specific list of PCEPExtensionProviderActivator OSGi services announced via
+       META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator resources.
+  -->
+  <odl:specific-reference-list id="extensionActivators" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"/>
+
+  <bean id="extensionProviderContext" class="org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext"/>
+
+  <bean id="extensionProviderContextActivator" class="org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContextActivator"
+      init-method="start" destroy-method="close">
+    <argument ref="extensionProviderContext"/>
+    <argument ref="extensionActivators"/>
+  </bean>
+
+  <service ref="extensionProviderContext">
+    <interfaces>
+      <value>org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext</value>
+      <value>org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext</value>
+    </interfaces>
+  </service>
+</blueprint>
\ No newline at end of file
index 4e994712649e0462e6509e629c59bc579ef6e396..deadb7222405f526468df523968e56d2375e5e31 100644 (file)
@@ -50,6 +50,7 @@ module odl-pcep-spi-cfg {
 
         base "config:service-type";
         config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator";
+        config:disable-osgi-service-registration;
     }
 
     identity pcep-extensions-impl {
@@ -61,15 +62,6 @@ module odl-pcep-spi-cfg {
     augment "/config:modules/config:module/config:configuration" {
         case pcep-extensions-impl {
             when "/config:modules/config:module/config:type = 'pcep-extensions-impl'";
-
-            list extension {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity extension;
-                    }
-                }
-            }
         }
     }
 }
diff --git a/pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContextTest.java b/pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/ReusablePCEPExtensionProviderContextTest.java
deleted file mode 100644 (file)
index 8585445..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2015 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.spi;
-
-import static org.junit.Assert.assertEquals;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
-import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.ObjectParser;
-import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-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.types.rev131005.Message;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.Subobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.Rp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.EnterpriseSpecificInformation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase;
-
-/**
- * Created by cgasparini on 17.6.2015.
- */
-public class ReusablePCEPExtensionProviderContextTest {
-
-    List<PCEPExtensionProviderContext> AuxList = new ArrayList<>();
-
-    @Mock
-    XROSubobjectParser xroParser;
-    @Mock
-    XROSubobjectSerializer xroSerializer;
-
-    @Mock
-    RROSubobjectParser rroParser;
-    @Mock
-    RROSubobjectSerializer rroSerializer;
-
-    @Mock
-    EROSubobjectParser eroParser;
-    @Mock
-    EROSubobjectSerializer eroSerializer;
-
-    @Mock
-    TlvParser tlvParser;
-    @Mock
-    TlvSerializer tlvSerializer;
-
-    @Mock
-    ObjectParser objectParser;
-    @Mock
-    ObjectSerializer objectSerializer;
-
-    @Mock
-    MessageParser msgParser;
-    @Mock
-    MessageSerializer msgSerializer;
-
-    @Mock
-    LabelParser labelParser;
-    @Mock
-    LabelSerializer labelSerializer;
-    @Mock
-    VendorInformationTlv viTlv;
-    @Mock
-    EnterpriseSpecificInformation es;
-    @Mock
-    VendorInformationObject esi;
-
-    @Before
-    public void setUp() throws PCEPDeserializerException {
-        MockitoAnnotations.initMocks(this);
-
-        Mockito.doReturn(null).when(this.xroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
-        Mockito.doNothing().when(this.xroSerializer).serializeSubobject(Mockito.any(Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.rroParser).parseSubobject(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.rroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.eroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
-        Mockito.doNothing().when(this.eroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(this.viTlv).when(this.tlvParser).parseTlv(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.tlvSerializer).serializeTlv(Mockito.any(Tlv.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(new OpenBuilder().build()).when(this.objectParser).parseObject(Mockito.any(ObjectHeader.class), Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.objectSerializer).serializeObject(Mockito.any(org.opendaylight.yang.gen.v1.urn
-            .opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.msgParser).parseMessage(Mockito.any(ByteBuf.class), Mockito.any(List.class));
-        Mockito.doNothing().when(this.msgSerializer).serializeMessage(Mockito.any(Message.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(null).when(this.labelParser).parseLabel(Mockito.any(ByteBuf.class));
-        Mockito.doNothing().when(this.labelSerializer).serializeLabel(Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.any(LabelType.class), Mockito.any(ByteBuf.class));
-
-        Mockito.doReturn(this.es).when(this.esi).getEnterpriseSpecificInformation();
-
-        Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
-
-        Mockito.doReturn(this.es).when(this.viTlv).getEnterpriseSpecificInformation();
-
-        Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
-    }
-
-    @Test
-    public void testReusablePCEPExtensionProviderContext() throws PCEPDeserializerException {
-        List<PCEPExtensionProviderActivator> list = new ArrayList<>();
-        list.add(new simplePCEPExtensionProviderActivator());
-        list.add(new simplePCEPExtensionProviderActivator());
-
-
-        ReusablePCEPExtensionProviderContext ctx = new ReusablePCEPExtensionProviderContext();
-        ctx.start(list);
-
-        assertEquals(2, AuxList.size());
-
-        final List<PCEPExtensionProviderActivator> listReconf = new ArrayList<>();
-        listReconf.add(new simplePCEPExtensionProviderActivator());
-        listReconf.add(new simplePCEPExtensionProviderActivator());
-        listReconf.add(new simplePCEPExtensionProviderActivator());
-        listReconf.add(new simplePCEPExtensionProviderActivator());
-        ctx.reconfigure(listReconf);
-        assertEquals(4, AuxList.size());
-
-        ctx.registerLabelParser(1, this.labelParser);
-        ctx.registerLabelSerializer(Type1LabelCase.class, this.labelSerializer);
-
-        ctx.registerEROSubobjectParser(2, this.eroParser);
-        ctx.registerEROSubobjectSerializer(IpPrefixCase.class, this.eroSerializer);
-
-        ctx.registerMessageParser(6, this.msgParser);
-        ctx.registerMessageSerializer(Keepalive.class, this.msgSerializer);
-
-        ctx.registerObjectParser(5, 1, this.objectParser);
-        ctx.registerObjectSerializer(Rp.class, this.objectSerializer);
-
-        ctx.registerRROSubobjectParser(3, this.rroParser);
-        ctx.registerRROSubobjectSerializer(LabelCase.class, this.rroSerializer);
-
-        ctx.registerTlvParser(1, this.tlvParser);
-        ctx.registerTlvSerializer(OfList.class, this.tlvSerializer);
-
-        ctx.registerXROSubobjectParser(2, this.xroParser);
-        ctx.registerXROSubobjectSerializer(AsNumberCase.class, this.xroSerializer);
-
-        ctx.registerVendorInformationTlvSerializer(EnterpriseSpecificInformation.class, this.tlvSerializer);
-        ctx.registerVendorInformationTlvParser(new EnterpriseNumber(12L), this.tlvParser);
-
-        ctx.registerVendorInformationObjectParser(new EnterpriseNumber(10L), this.objectParser);
-        ctx.registerVendorInformationObjectSerializer(EnterpriseSpecificInformation.class, this.objectSerializer);
-
-        final ByteBuf buffer = Unpooled.buffer();
-        ctx.getEROSubobjectHandlerRegistry().parseSubobject(3, buffer, true);
-
-        ctx.getEROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.
-            SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
-
-        ctx.getLabelHandlerRegistry().parseLabel(1, buffer);
-        ctx.getLabelHandlerRegistry().serializeLabel(true, false, new Type1LabelCaseBuilder().build(), buffer);
-
-        ctx.getMessageHandlerRegistry().parseMessage(6, buffer, Collections.<Message>emptyList());
-        ctx.getMessageHandlerRegistry().serializeMessage(new KeepaliveBuilder().build(), buffer);
-
-        ctx.getObjectHandlerRegistry().parseObject(4, 1, new ObjectHeaderImpl(true, false), buffer);
-        ctx.getObjectHandlerRegistry().serializeObject(new OpenBuilder().build(), buffer);
-
-        ctx.getRROSubobjectHandlerRegistry().parseSubobject(4, buffer);
-        ctx.getRROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder().setSubobjectType(new IpPrefixCaseBuilder().build()).build(), buffer);
-
-        ctx.getTlvHandlerRegistry().parseTlv(2, buffer);
-        ctx.getTlvHandlerRegistry().serializeTlv(new OfListBuilder().build(), buffer);
-
-        ctx.getVendorInformationObjectRegistry().parseVendorInformationObject(new EnterpriseNumber(10L), new ObjectHeaderImpl(true, false), buffer);
-        ctx.getVendorInformationObjectRegistry().serializeVendorInformationObject(this.esi, buffer);
-
-        ctx.getVendorInformationTlvRegistry().parseVendorInformationTlv(new EnterpriseNumber(12L), buffer);
-        ctx.getVendorInformationTlvRegistry().serializeVendorInformationTlv(this.viTlv, buffer);
-
-        ctx.getXROSubobjectHandlerRegistry().parseSubobject(2, buffer, false);
-        ctx.getXROSubobjectHandlerRegistry().serializeSubobject(new SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
-
-        ctx.close();
-        assertEquals(0, AuxList.size());
-    }
-
-    class simplePCEPExtensionProviderActivator implements PCEPExtensionProviderActivator {
-        @Override
-        public void start(final PCEPExtensionProviderContext context) {
-            AuxList.add(context);
-        }
-
-        @Override
-        public void stop() {
-            AuxList.remove(AuxList.size() - 1);
-        }
-    }
-}
\ No newline at end of file
diff --git a/pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleTest.java b/pcep/spi/src/test/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleTest.java
deleted file mode 100644 (file)
index 383d4d3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.pcep.spi;
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-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;
-
-public class SimplePCEPExtensionProviderContextModuleTest extends AbstractConfigTest {
-
-    private static final String FACTORY_NAME = SimplePCEPExtensionProviderContextModuleFactory.NAME;
-    private static final String INSTANCE_NAME = "pcep-extensions-impl";
-
-    @Before
-    public void setUp() throws Exception {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new SimplePCEPExtensionProviderContextModuleFactory()));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-        CommitStatus status = createInstance();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 1, 0, 0);
-    }
-
-    @Test
-    public void testReusingOldInstance() throws Exception {
-        createInstance();
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        assertBeanCount(1, FACTORY_NAME);
-        CommitStatus status = transaction.commit();
-        assertBeanCount(1, FACTORY_NAME);
-        assertStatus(status, 0, 0, 1);
-    }
-
-    private CommitStatus createInstance() throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-        return transaction.commit();
-    }
-
-    public static ObjectName createPCEPExtensionsModuleInstance(final ConfigTransactionJMXClient transaction,
-            final List<ObjectName> extensions) throws Exception {
-        final ObjectName objectName = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-        SimplePCEPExtensionProviderContextModuleMXBean mxBean = transaction.newMXBeanProxy(objectName,
-                SimplePCEPExtensionProviderContextModuleMXBean.class);
-        mxBean.setExtension(extensions);
-        return objectName;
-    }
-
-}
index 590167b6a79f730c547840ccefd6fd97aac8a61f..1dcddd13e5f4971dfff5b141e7ecb03fcba486e1 100644 (file)
@@ -14,6 +14,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
 import javax.management.ObjectName;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.api.jmx.CommitStatus;
@@ -25,6 +26,8 @@ import org.opendaylight.controller.config.yang.pcep.impl.PCEPSessionProposalFact
 import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
 import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.PCEPStatefulCapabilityModuleFactory;
 import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
+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;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key;
@@ -40,6 +43,14 @@ public class PCEPTopologyProviderModuleTest extends AbstractInstructionScheduler
     private static final PortNumber LISTEN_PORT = new PortNumber(4189);
     private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology");
 
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
+    }
+
     @Test
     public void testValidationExceptionListenAddressNotSet() throws Exception {
         try {
index 5fa6903dc98cb5388665b0a62292539b385c79e2..73ad20fa7608ec0cf392487aa0dbae5c1c9dd3cf 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import java.util.List;
 import javax.management.ObjectName;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.api.jmx.CommitStatus;
@@ -26,6 +27,8 @@ import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopolo
 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.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;
 
 public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSchedulerTest {
@@ -35,6 +38,14 @@ public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSch
 
     private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology");
 
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
+    }
+
     @Test
     public void testValidationExceptionTopologyIdNotSet() throws Exception {
         try {
index bfa2c8e9f6778f77806e604e23ce1f6381cefb1a..eb757951698d5b76c53274966b3830a20e6a31c0 100644 (file)
@@ -180,7 +180,7 @@ public abstract class AbstractInstructionSchedulerTest extends AbstractConfigTes
         setupMockService(DOMRpcProviderService.class, mockRpcProvider);
     }
 
-    private void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
+    protected 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()));