Add configuration for extensions 41/2841/7
authorRobert Varga <rovarga@cisco.com>
Sat, 16 Nov 2013 08:00:20 +0000 (09:00 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 20 Nov 2013 09:03:39 +0000 (09:03 +0000)
Change-Id: I55c089db790ada2260155e17cb35136a3baa8c80
Signed-off-by: Robert Varga <rovarga@cisco.com>
110 files changed:
bgp/linkstate-config/.project [new file with mode: 0644]
bgp/linkstate-config/pom.xml [new file with mode: 0644]
bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModule.java [new file with mode: 0644]
bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModuleFactory.java [new file with mode: 0644]
bgp/linkstate-config/src/main/yang/config-bgp-linkstate.yang [new file with mode: 0644]
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/OSGiActivator.java [deleted file]
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/RIBActivator.java
bgp/parser-impl/pom.xml
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java [moved from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/Activator.java with 98% similarity]
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BundleActivator.java [deleted file]
bgp/parser-impl/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator
bgp/parser-spi-config/.project [new file with mode: 0644]
bgp/parser-spi-config/pom.xml [new file with mode: 0644]
bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModule.java [new file with mode: 0644]
bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModuleFactory.java [new file with mode: 0644]
bgp/parser-spi-config/src/main/yang/config-bgp-parser-spi.yang [new file with mode: 0644]
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/BGPExtensionProviderActivator.java
bgp/pom.xml
bgp/rib-impl-config/pom.xml
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModule.java
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java
bgp/rib-impl-config/src/main/yang/bgp-rib-impl.yang
bgp/rib-impl/pom.xml
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBActivator.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/Activator.java with 55% similarity]
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBExtensionProviderContextImpl.java [moved from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRIBsInFactoryRegistryImpl.java with 81% similarity]
bgp/rib-spi-config/.project [new file with mode: 0644]
bgp/rib-spi-config/pom.xml [new file with mode: 0644]
bgp/rib-spi-config/src/main/yang/config-bgp-rib-spi.yang [new file with mode: 0644]
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBExtensionProviderActivator.java
bgp/topology-provider-config/.project [new file with mode: 0644]
bgp/topology-provider-config/pom.xml [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModule.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModuleFactory.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModule.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModuleFactory.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModule.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModuleFactory.java [new file with mode: 0644]
bgp/topology-provider-config/src/main/yang/config-bgp-topology-provider.yang [new file with mode: 0644]
bgp/topology-provider/pom.xml
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/AbstractReachabilityTopologyBuilder.java [moved from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/AbstractReachabilityTopologyBuilder.java with 91% similarity]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/AbstractTopologyBuilder.java [moved from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/AbstractLocRIBListener.java with 56% similarity]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/Ipv4ReachabilityTopologyBuilder.java [moved from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/Ipv4ReachabilityTopologyBuilder.java with 68% similarity]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/Ipv6ReachabilityTopologyBuilder.java [moved from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/Ipv6ReachabilityTopologyBuilder.java with 68% similarity]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/LinkstateTopologyBuilder.java [moved from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/LinkstateTopologyBuilder.java with 97% similarity]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/LocRIBListeners.java [deleted file]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/Activator.java [deleted file]
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/LocRIBListenerSubscriptionTracker.java [deleted file]
concepts/src/main/java/org/opendaylight/protocol/concepts/DefaultInstanceReference.java [new file with mode: 0644]
concepts/src/main/java/org/opendaylight/protocol/concepts/InstanceReference.java [new file with mode: 0644]
pcep/impl-config/pom.xml
pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModule.java
pcep/impl-config/src/main/yang/pcep-impl.yang
pcep/impl-config/src/test/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleTest.java
pcep/impl/pom.xml
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/BundleActivator.java [deleted file]
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPEROSubobjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPRROSubobjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java
pcep/pom.xml
pcep/spi-config/.project [new file with mode: 0644]
pcep/spi-config/pom.xml [new file with mode: 0644]
pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java [new file with mode: 0644]
pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java [new file with mode: 0644]
pcep/spi-config/src/main/yang/config-pcep-spi.yang [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/ServiceLoaderPCEPExtensionProviderContext.java [new file with mode: 0644]
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java [moved from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java with 63% similarity]
pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java
pcep/testtool/src/test/java/org/opendaylight/protocol/pcep/testtool/PCCMock.java
pcep/topology-provider-config/.project [new file with mode: 0644]
pcep/topology-provider-config/pom.xml [new file with mode: 0644]
pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModule.java [new file with mode: 0644]
pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModuleFactory.java [new file with mode: 0644]
pcep/topology-provider-config/src/main/yang/config-pcep-topology-provider.yang [new file with mode: 0644]
pcep/topology-provider/pom.xml
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/BundleActivator.java [deleted file]
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologyProvider.java
pcep/tunnel-provider-config/.project [new file with mode: 0644]
pcep/tunnel-provider-config/pom.xml [new file with mode: 0644]
pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModule.java [new file with mode: 0644]
pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleFactory.java [new file with mode: 0644]
pcep/tunnel-provider-config/src/main/yang/config-pcep-tunnel-provider.yang [new file with mode: 0644]
pcep/tunnel-provider/pom.xml
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/BundleActivator.java [deleted file]
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/PCEPTunnelTopologyProvider.java [new file with mode: 0644]
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelProgramming.java
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelTopologyExporter.java [deleted file]
programming/impl-config/.project [new file with mode: 0644]
programming/impl-config/pom.xml [new file with mode: 0644]
programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModule.java [new file with mode: 0644]
programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModuleFactory.java [new file with mode: 0644]
programming/impl-config/src/main/yang/config-programming-impl.yang [new file with mode: 0644]
programming/impl/pom.xml
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/BundleActivator.java [deleted file]
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImpl.java
programming/pom.xml
programming/spi-config/.project [new file with mode: 0644]
programming/spi-config/pom.xml [new file with mode: 0644]
programming/spi-config/src/main/yang/config-programming-spi.yang [new file with mode: 0644]
topology/api-config/.project [new file with mode: 0644]
topology/api-config/pom.xml [new file with mode: 0644]
topology/api-config/src/main/yang/config-topology-api.yang [new file with mode: 0644]
topology/api/pom.xml
topology/api/src/main/java/org/opendaylight/bgpcep/topology/DefaultTopologyReference.java [new file with mode: 0644]
topology/api/src/main/java/org/opendaylight/bgpcep/topology/TopologyReference.java [new file with mode: 0644]
topology/pom.xml

diff --git a/bgp/linkstate-config/.project b/bgp/linkstate-config/.project
new file mode 100644 (file)
index 0000000..c585d6c
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>bgp-linkstate-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/bgp/linkstate-config/pom.xml b/bgp/linkstate-config/pom.xml
new file mode 100644 (file)
index 0000000..ec741d8
--- /dev/null
@@ -0,0 +1,108 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>bgp-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>bgp-linkstate-config</artifactId>
+   <description>BGP Linkstate configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-linkstate</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-parser-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.bgp.linkstate
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-LINKSTATE-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModule.java b/bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModule.java
new file mode 100644 (file)
index 0000000..046709b
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-bgp-linkstate  yang module local name: bgp-linkstate
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Sat Nov 16 08:52:43 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.linkstate;
+
+import org.opendaylight.protocol.bgp.linkstate.BGPActivator;
+import org.opendaylight.protocol.bgp.linkstate.RIBActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
+
+/**
+ *
+ */
+public final class LinkstateModule extends org.opendaylight.controller.config.yang.bgp.linkstate.AbstractLinkstateModule
+{
+
+       public LinkstateModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public LinkstateModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final LinkstateModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final RIBExtensionProviderContext ribctx = getRibExtensionsDependency();
+               final RIBExtensionProviderActivator ribact;
+               if (ribctx != null) {
+                       ribact = new RIBActivator();
+                       ribact.startRIBExtensionProvider(ribctx);
+               } else {
+                       ribact = null;
+               }
+
+               final BGPExtensionProviderActivator bgpact;
+               if (getBgpExtensionsDependency() != null) {
+                       bgpact = new BGPActivator();
+                       bgpact.start(getBgpExtensionsDependency());
+               } else {
+                       bgpact = null;
+               }
+
+               return new AutoCloseable() {
+                       @Override
+                       public void close() {
+                               if (bgpact != null) {
+                                       bgpact.stop();
+                               }
+                               if (ribact != null) {
+                                       ribact.stopRIBExtensionProvider();
+                               }
+                       }
+               };
+       }
+}
diff --git a/bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModuleFactory.java b/bgp/linkstate-config/src/main/java/org/opendaylight/controller/config/yang/bgp/linkstate/LinkstateModuleFactory.java
new file mode 100644 (file)
index 0000000..2d82375
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-linkstate  yang module local name: bgp-linkstate
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sat Nov 16 08:52:43 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.linkstate;
+
+/**
+*
+*/
+public class LinkstateModuleFactory extends org.opendaylight.controller.config.yang.bgp.linkstate.AbstractLinkstateModuleFactory
+{
+
+
+}
diff --git a/bgp/linkstate-config/src/main/yang/config-bgp-linkstate.yang b/bgp/linkstate-config/src/main/yang/config-bgp-linkstate.yang
new file mode 100644 (file)
index 0000000..d7811f6
--- /dev/null
@@ -0,0 +1,59 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-bgp-linkstate {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:linkstate";
+    prefix "bgpls";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import config-bgp-parser-spi { prefix bgpspi; revision-date 2013-11-15; }
+    import config-bgp-rib-spi { prefix ribspi; revision-date 2013-11-15; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP Linkstate extension.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity bgp-linkstate {
+        base config:module-type;
+//        config:provided-service bgpl:listener;
+        config:java-name-prefix Linkstate;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-linkstate {
+            when "/config:modules/config:module/config:type = 'bgp-linkstate'";
+
+            container bgp-extensions {
+                uses config:service-ref {
+                    refine type {
+                        config:required-identity bgpspi:extensions;
+                    }
+                }
+            }
+
+            container rib-extensions {
+                uses config:service-ref {
+                    refine type {
+                        config:required-identity ribspi:extensions;
+                    }
+                }
+            }
+        }
+    }
+}
+
diff --git a/bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/OSGiActivator.java b/bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/OSGiActivator.java
deleted file mode 100644 (file)
index 19b2b7c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.linkstate;
-
-import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
-import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
-import org.opendaylight.protocol.bgp.parser.spi.osgi.AbstractOSGiBGPExtensionProviderActivator;
-
-public final class OSGiActivator extends AbstractOSGiBGPExtensionProviderActivator {
-       private final BGPExtensionProviderActivator activator = new BGPActivator();
-
-       @Override
-       public void start(final BGPExtensionProviderContext context) throws Exception {
-               activator.start(context);
-       }
-
-       @Override
-       public void stop() throws Exception {
-               activator.stop();
-       }
-}
index 1c38415728554fcd0be4c8b4e3fca56f757dd702..879e79e7be6fb04303fcfa33a7b2cd4ca2a9633c 100644 (file)
@@ -17,14 +17,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.PathAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 
 public final class RIBActivator implements RIBExtensionProviderActivator {
+       private static final Logger LOG = LoggerFactory.getLogger(RIBActivator.class);
        private AutoCloseable reg;
 
        @Override
-       public void startRIBExtensionProvider(final RIBExtensionProviderContext context) throws Exception {
+       public void startRIBExtensionProvider(final RIBExtensionProviderContext context) {
                Preconditions.checkState(reg == null);
 
                reg = context.registerAdjRIBsInFactory(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class, new AdjRIBsInFactory() {
@@ -36,10 +39,15 @@ public final class RIBActivator implements RIBExtensionProviderActivator {
        }
 
        @Override
-       public void stopRIBExtensionProvider(final RIBExtensionProviderContext context) throws Exception {
+       public void stopRIBExtensionProvider() {
                if (reg != null) {
-                       reg.close();
-                       reg = null;
+                       try {
+                               reg.close();
+                       } catch (Exception e) {
+                               LOG.warn("Failed to unregister Linkstate extension", e);
+                       } finally {
+                               reg = null;
+                       }
                }
        }
 }
index 85d3ad02012fefd5049416ad0fc62d0dc8234020..f67515a0b69ae52adb6b44cb9c9ae5dfedf6003b 100644 (file)
                                                <Export-Package>
                                                        org.opendaylight.protocol.bgp.parser.impl.*
                                                </Export-Package>
-                        <Activator>org.opendaylight.protocol.bgp.parser.impl.BundleActivator</Activator>
                                        </instructions>
                                </configuration>
                        </plugin>
similarity index 98%
rename from bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/Activator.java
rename to bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java
index 077a3fe7105c46febc157d984b3e6d01ae096a02..fafe5b2d88f4976d8421cdf509c72ab6f364db5b 100644 (file)
@@ -57,8 +57,8 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 
-public final class Activator implements BGPExtensionProviderActivator {
-       private static final Logger logger = LoggerFactory.getLogger(Activator.class);
+public final class BGPActivator implements BGPExtensionProviderActivator {
+       private static final Logger logger = LoggerFactory.getLogger(BGPActivator.class);
        private List<AutoCloseable> registrations;
 
        @Override
diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BundleActivator.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BundleActivator.java
deleted file mode 100644 (file)
index b528a0d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.parser.impl;
-
-import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
-import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
-import org.opendaylight.protocol.bgp.parser.spi.osgi.AbstractOSGiBGPExtensionProviderActivator;
-
-public final class BundleActivator extends AbstractOSGiBGPExtensionProviderActivator {
-       private final BGPExtensionProviderActivator activator = new Activator();
-
-       @Override
-       public void start(final BGPExtensionProviderContext context) throws Exception {
-               activator.start(context);
-       }
-
-       @Override
-       public void stop() throws Exception {
-               activator.stop();
-       }
-}
diff --git a/bgp/parser-spi-config/.project b/bgp/parser-spi-config/.project
new file mode 100644 (file)
index 0000000..182e916
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>bgp-parser-spi-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/bgp/parser-spi-config/pom.xml b/bgp/parser-spi-config/pom.xml
new file mode 100644 (file)
index 0000000..568ba3d
--- /dev/null
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>bgp-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>bgp-parser-spi-config</artifactId>
+   <description>BGP RIB API CONFIG</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-parser-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.bgp.parser.spi
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-PARSER-SPI-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModule.java b/bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModule.java
new file mode 100644 (file)
index 0000000..836c442
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-parser-spi  yang module local name: bgp-extensions-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 10:44:24 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.parser.spi;
+
+/**
+*
+*/
+public final class SimpleBGPExtensionProviderContextModule extends org.opendaylight.controller.config.yang.bgp.parser.spi.AbstractSimpleBGPExtensionProviderContextModule
+{
+
+    public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public SimpleBGPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, SimpleBGPExtensionProviderContextModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate(){
+        super.validate();
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModuleFactory.java b/bgp/parser-spi-config/src/main/java/org/opendaylight/controller/config/yang/bgp/parser/spi/SimpleBGPExtensionProviderContextModuleFactory.java
new file mode 100644 (file)
index 0000000..f5c18a1
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-parser-spi  yang module local name: bgp-extensions-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 10:44:24 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.parser.spi;
+
+/**
+*
+*/
+public class SimpleBGPExtensionProviderContextModuleFactory extends org.opendaylight.controller.config.yang.bgp.parser.spi.AbstractSimpleBGPExtensionProviderContextModuleFactory
+{
+
+
+}
diff --git a/bgp/parser-spi-config/src/main/yang/config-bgp-parser-spi.yang b/bgp/parser-spi-config/src/main/yang/config-bgp-parser-spi.yang
new file mode 100644 (file)
index 0000000..7e09f37
--- /dev/null
@@ -0,0 +1,59 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-bgp-parser-spi {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:parser:spi";
+    prefix "bgpspi";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP listener service.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity consumer-extensions {
+        description
+            "Service representing a BGP parser extension registry. Extension
+            consumers have this service injected.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext";
+    }
+
+    identity extensions {
+        description
+            "Service representing a BGP parser extension registry. Extension
+            providers have this service injected for registration.";
+
+        base "consumer-extensions";
+        config:java-class "org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext";
+    }
+
+    identity bgp-extensions-impl {
+        base config:module-type;
+        config:provided-service extensions;
+        config:java-name-prefix SimpleBGPExtensionProviderContext;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-extensions-impl {
+            when "/config:modules/config:module/config:type = 'bgp-extensions-impl'";
+        }
+    }
+}
+
index 827b9f9173e1971316d093c932c2c09ce17856cb..bc4a177b1cf153c3139b76a3670aebf1c3ead80b 100644 (file)
@@ -8,6 +8,6 @@
 package org.opendaylight.protocol.bgp.parser.spi;
 
 public interface BGPExtensionProviderActivator {
-       public void start(BGPExtensionProviderContext context) throws Exception;
-       public void stop() throws Exception;
+       public void start(BGPExtensionProviderContext context);
+       public void stop();
 }
\ No newline at end of file
index 99a6075f47658ae9ff5dff20825c64e75a0c854a..2ea9fada9b2eb21dd774df4dbfbd8013471dd941 100644 (file)
        <modules>
                <module>concepts</module>
                <module>linkstate</module>
+               <module>linkstate-config</module>
         <module>parser-api</module>
         <module>parser-spi</module>
+        <module>parser-spi-config</module>
         <module>parser-impl</module>
         <module>parser-mock</module>
         <module>rib-api</module>
+        <module>rib-api-config</module>
         <module>rib-spi</module>
+        <module>rib-spi-config</module>
         <module>rib-impl</module>
+        <module>rib-impl-config</module>
         <module>testtool</module>
         <module>rib-mock</module>
         <module>topology-provider</module>
+        <module>topology-provider-config</module>
         <module>util</module>
-        <module>rib-api-config</module>
         <module>update-api-config</module>
         <module>update-mock-config</module>
-        <module>rib-impl-config</module>
        </modules>
 </project>
index ac4330cfcca735efa7ce71c5694e6f3b70b338a1..e8eb1d358e1e1e2b9c5e70429c5199f792ddda70 100644 (file)
          <artifactId>bgp-rib-api-config</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
       <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>bgp-parser-api</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-parser-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
       <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>bgp-rib-impl</artifactId>
          <url>${basedir}/target/site/${project.artifactId}</url>
       </site>
    </distributionManagement>
-</project>
\ No newline at end of file
+</project>
index 235ba2317c22b03609f57bee7d48ff25cacc03b0..b0608ca96d06b8a6675e97547742c11a059f1b1b 100644 (file)
@@ -11,29 +11,28 @@ package org.opendaylight.controller.config.yang.bgp.rib.impl;
 
 import org.opendaylight.protocol.bgp.parser.BGPMessageFactory;
 import org.opendaylight.protocol.bgp.parser.impl.BGPMessageFactoryImpl;
-import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
 import org.opendaylight.protocol.framework.DeserializerException;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
-*
-*/
+ *
+ */
 public final class BGPMessageFactoryImplModule
-               extends
-               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPMessageFactoryImplModule {
+extends
+org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPMessageFactoryImplModule {
 
        public BGPMessageFactoryImplModule(
-                       org.opendaylight.controller.config.api.ModuleIdentifier name,
-                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+                       final org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
                super(name, dependencyResolver);
        }
 
        public BGPMessageFactoryImplModule(
-                       org.opendaylight.controller.config.api.ModuleIdentifier name,
-                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-                       BGPMessageFactoryImplModule oldModule,
-                       java.lang.AutoCloseable oldInstance) {
+                       final org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       final BGPMessageFactoryImplModule oldModule,
+                       final java.lang.AutoCloseable oldInstance) {
                super(name, dependencyResolver, oldModule, oldInstance);
        }
 
@@ -47,19 +46,18 @@ public final class BGPMessageFactoryImplModule
        public java.lang.AutoCloseable createInstance() {
                try {
                        return new BGPMessageFactoryCloseable(new BGPMessageFactoryImpl(
-                                       ServiceLoaderBGPExtensionProviderContext
-                                                       .createConsumerContext().getMessageRegistry()));
+                                       getBgpExtensionsDependency().getMessageRegistry()));
                } catch (Exception e) {
                        throw new RuntimeException("Failed to create consumer context.", e);
                }
        }
 
        private static class BGPMessageFactoryCloseable implements
-                       BGPMessageFactory, AutoCloseable {
+       BGPMessageFactory, AutoCloseable {
                private final BGPMessageFactoryImpl inner;
 
                public BGPMessageFactoryCloseable(
-                               BGPMessageFactoryImpl bgpMessageFactory) {
+                               final BGPMessageFactoryImpl bgpMessageFactory) {
                        this.inner = bgpMessageFactory;
                }
 
@@ -69,13 +67,13 @@ public final class BGPMessageFactoryImplModule
                }
 
                @Override
-               public Notification parse(byte[] bytes) throws DeserializerException,
-                               DocumentedException {
+               public Notification parse(final byte[] bytes) throws DeserializerException,
+               DocumentedException {
                        return inner.parse(bytes);
                }
 
                @Override
-               public byte[] put(Notification bgpMessage) {
+               public byte[] put(final Notification bgpMessage) {
                        return inner.put(bgpMessage);
                }
        }
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModule.java
new file mode 100644 (file)
index 0000000..3f357a7
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: base-bgp-parser
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Mon Nov 18 10:59:18 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.rib.impl;
+
+import org.opendaylight.protocol.bgp.parser.impl.BGPActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+
+/**
+ *
+ */
+public final class BaseBGPParserModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBaseBGPParserModule
+{
+
+       public BaseBGPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public BaseBGPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BaseBGPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final BGPExtensionProviderActivator act = new BGPActivator();
+
+               act.start(getBgpExtensionsDependency());
+               return new AutoCloseable() {
+                       @Override
+                       public void close() {
+                               act.stop();
+                       }
+               };
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BaseBGPParserModuleFactory.java
new file mode 100644 (file)
index 0000000..3f037fe
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: bgp-rib-impl  yang module local name: base-bgp-parser
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 10:59:18 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.rib.impl;
+
+/**
+*
+*/
+public class BaseBGPParserModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBaseBGPParserModuleFactory
+{
+
+
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModule.java
new file mode 100644 (file)
index 0000000..a9ccc5f
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-rib-extensions-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Fri Nov 15 17:49:05 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.rib.impl;
+
+import org.opendaylight.protocol.bgp.rib.impl.RIBExtensionProviderContextImpl;
+
+/**
+ *
+ */
+public final class RIBExtensionsImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBExtensionsImplModule
+{
+
+       public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBExtensionsImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final class RIBExtensionProviderContextImplCloseable extends RIBExtensionProviderContextImpl implements AutoCloseable {
+                       @Override
+                       public void close() {
+
+                       }
+               }
+
+               return new RIBExtensionProviderContextImplCloseable();
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBExtensionsImplModuleFactory.java
new file mode 100644 (file)
index 0000000..d1cdd27
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-rib-extensions-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Nov 15 17:49:05 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.rib.impl;
+
+/**
+*
+*/
+public class RIBExtensionsImplModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBExtensionsImplModuleFactory
+{
+
+
+}
index 9097274c36416b928cd3ada5d5a2c62e27479d29..034f364d3455dbbc1393c7141d7ec9c9245929b9 100644 (file)
@@ -55,6 +55,8 @@ org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModule {
                                "value is not set.", ribNameJmxAttribute);
                JmxAttributeValidationException.checkCondition(!getRibName().isEmpty(),
                                "should not be empty string.", ribNameJmxAttribute);
+               JmxAttributeValidationException.checkNotNull(getExtensions(),
+                               "is not set.", extensionsJmxAttribute);
        }
 
        @Override
@@ -66,8 +68,7 @@ org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModule {
                DataProviderService dataProviderService = providerContext
                                .getSALService(DataProviderService.class);
 
-               // FIXME: deal with Extensions
-               RIBImpl rib = new RIBImpl(null, dataProviderService);
+               RIBImpl rib = new RIBImpl(getExtensionsDependency(), dataProviderService);
                BGP bgp = getBgpDependency();
                final BGPPeer peer = new BGPPeer(rib, "peer-" + bgp.toString());
 
index b1510f0eccd04bb13442f3a49dbbebec79c0da28..ffc799afa03e3c6648406b3810f2586fd3b776b3 100644 (file)
@@ -6,6 +6,8 @@ module bgp-rib-impl {
 
     import bgp-listener { prefix bgpl; revision-date 2013-04-09; }
     import bgp-rib { prefix bgprib; revision-date 2013-07-01; }
+    import config-bgp-parser-spi { prefix bgpspi; revision-date 2013-11-15; }
+    import config-bgp-rib-spi { prefix ribspi; revision-date 2013-11-15; }
     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
     import threadpool { prefix th; revision-date 2013-04-09; }
     import config { prefix config; revision-date 2013-04-05; }
@@ -30,6 +32,26 @@ module bgp-rib-impl {
             "Initial revision";
     }
 
+    identity base-bgp-parser {
+        base config:module-type;
+        config:java-name-prefix BaseBGPParser;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case base-bgp-parser {
+            when "/config:modules/config:module/config:type = 'base-bgp-parser'";
+
+            container bgp-extensions {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgpspi:extensions;
+                    }
+                }
+            }
+        }
+    }
+
     identity bgp-message-factory {
         description
             "Service representing a BGP proposal.";
@@ -42,12 +64,32 @@ module bgp-rib-impl {
         base config:module-type;
         config:provided-service bgp-message-factory;
         config:java-name-prefix BGPMessageFactoryImpl;
-
     }
 
     augment "/config:modules/config:module/config:configuration" {
         case bgp-message-factory-impl {
             when "/config:modules/config:module/config:type = 'bgp-message-factory-impl'";
+
+            container bgp-extensions {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgpspi:consumer-extensions;
+                    }
+                }
+            }
+        }
+    }
+
+    identity bgp-rib-extensions-impl {
+        base config:module-type;
+        config:provided-service ribspi:extensions;
+        config:java-name-prefix RIBExtensionsImpl;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-rib-extensions-impl {
+            when "/config:modules/config:module/config:type = 'bgp-rib-extensions-impl'";
         }
     }
 
@@ -63,7 +105,6 @@ module bgp-rib-impl {
         base config:module-type;
         config:provided-service bgp-proposal;
         config:java-name-prefix BGPSessionProposalImpl;
-
     }
 
     augment "/config:modules/config:module/config:configuration" {
@@ -99,7 +140,6 @@ module bgp-rib-impl {
         base config:module-type;
         config:provided-service bgp-dispatcher;
         config:java-name-prefix BGPDispatcherImpl;
-
     }
 
     augment "/config:modules/config:module/config:configuration" {
@@ -176,11 +216,11 @@ module bgp-rib-impl {
         }
     }
 
-     identity rib-impl {
+    identity rib-impl {
         base config:module-type;
         config:provided-service bgprib:rib;
         config:java-name-prefix RIBImpl;
-     }
+    }
 
 
     augment "/config:modules/config:module/config:configuration" {
@@ -196,6 +236,15 @@ module bgp-rib-impl {
                 }
             }
 
+            container extensions {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity ribspi:consumer-extensions;
+                    }
+                }
+            }
+
             leaf rib-name {
                  mandatory true;
                  type string;
@@ -221,7 +270,5 @@ module bgp-rib-impl {
             }
         }
     }
-
-
 }
 
index 89b4ff086b234b9285111b7b5330eb922ece98d1..50f579079211bbfd8c2af32fdc71db8e04765801 100644 (file)
                                                        org.opendaylight.protocol.bgp.rib.impl,
                                                        org.opendaylight.protocol.bgp.rib.impl.spi
                         </Export-Package>
-                        <Bundle-Activator>org.opendaylight.protocol.bgp.rib.impl.Activator</Bundle-Activator>
                                        </instructions>
                                </configuration>
                        </plugin>
similarity index 55%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/Activator.java
rename to bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBActivator.java
index f7e0c61f95a7452406caf74b353c16c14cd30d6b..bba3138852b1d49c084defb78908d5d1cfbf8258 100644 (file)
@@ -9,42 +9,64 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import java.util.Comparator;
 
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.protocol.bgp.rib.spi.AdjRIBsIn;
 import org.opendaylight.protocol.bgp.rib.spi.AdjRIBsInFactory;
+import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.PathAttributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-// FIXME: rework in terms of RIBExtensionProviderActivator
-public final class Activator extends AbstractBindingAwareProvider {
-       @SuppressWarnings("unused")
-       private RIBImpl rib;
+import com.google.common.base.Preconditions;
+
+public final class RIBActivator implements RIBExtensionProviderActivator {
+       private static final Logger LOG = LoggerFactory.getLogger(RIBActivator.class);
+       private AutoCloseable v4reg, v6reg;
 
        @Override
-       public void onSessionInitiated(final ProviderContext session) {
-               final RIBExtensionProviderContext reg = new AdjRIBsInFactoryRegistryImpl();
+       public void startRIBExtensionProvider(final RIBExtensionProviderContext context) {
+               Preconditions.checkState(v4reg == null);
+               Preconditions.checkState(v6reg == null);
 
-               reg.registerAdjRIBsInFactory(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, new AdjRIBsInFactory() {
+               v4reg = context.registerAdjRIBsInFactory(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, new AdjRIBsInFactory() {
                        @Override
                        public AdjRIBsIn createAdjRIBsIn(final Comparator<PathAttributes> comparator, final TablesKey key) {
                                return new Ipv4AdjRIBsIn(comparator, key);
                        }
                });
-               reg.registerAdjRIBsInFactory(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, new AdjRIBsInFactory() {
+
+               v6reg = context.registerAdjRIBsInFactory(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, new AdjRIBsInFactory() {
                        @Override
                        public AdjRIBsIn createAdjRIBsIn(final Comparator<PathAttributes> comparator, final TablesKey key) {
                                return new Ipv6AdjRIBsIn(comparator, key);
                        }
                });
 
+       }
 
-               // FIXME: publish the registry
-               this.rib = new RIBImpl(reg, session.getSALService(DataProviderService.class));
+       @Override
+       public void stopRIBExtensionProvider() {
+               if (v4reg != null) {
+                       try {
+                               v4reg.close();
+                       } catch (Exception e) {
+                               LOG.warn("Failed to unregister IPv4 extension", e);
+                       } finally {
+                               v4reg = null;
+                       }
+               }
+               if (v6reg != null) {
+                       try {
+                               v6reg.close();
+                       } catch (Exception e) {
+                               LOG.warn("Failed to unregister IPv6 extension", e);
+                       } finally {
+                               v6reg = null;
+                       }
+               }
        }
 }
similarity index 81%
rename from bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRIBsInFactoryRegistryImpl.java
rename to bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBExtensionProviderContextImpl.java
index e1015417efe9b36f31f76cf7edaaa7b6ad30d7be..9f49b5d15d010eded0e7def3d7951ffd72877d3a 100644 (file)
@@ -17,11 +17,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
 
-final class AdjRIBsInFactoryRegistryImpl implements RIBExtensionProviderContext {
+public class RIBExtensionProviderContextImpl implements RIBExtensionProviderContext {
        private final Map<TablesKey, AdjRIBsInFactory> factories = new ConcurrentHashMap<>();
 
        @Override
-       public synchronized AutoCloseable registerAdjRIBsInFactory(final Class<? extends AddressFamily> afi,
+       public final synchronized AbstractRegistration registerAdjRIBsInFactory(final Class<? extends AddressFamily> afi,
                        final Class<? extends SubsequentAddressFamily> safi, final AdjRIBsInFactory factory) {
                final TablesKey key = new TablesKey(afi, safi);
 
@@ -36,14 +36,14 @@ final class AdjRIBsInFactoryRegistryImpl implements RIBExtensionProviderContext
                        @Override
                        protected void removeRegistration() {
                                synchronized (lock) {
-                                       AdjRIBsInFactoryRegistryImpl.this.factories.remove(key);
+                                       RIBExtensionProviderContextImpl.this.factories.remove(key);
                                }
                        }
                };
        }
 
        @Override
-       public synchronized AdjRIBsInFactory getAdjRIBsInFactory(final Class<? extends AddressFamily> afi,
+       public final synchronized AdjRIBsInFactory getAdjRIBsInFactory(final Class<? extends AddressFamily> afi,
                        final Class<? extends SubsequentAddressFamily> safi) {
                return this.factories.get(new TablesKey(afi, safi));
        }
diff --git a/bgp/rib-spi-config/.project b/bgp/rib-spi-config/.project
new file mode 100644 (file)
index 0000000..a1a967e
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>bgp-rib-spi-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/bgp/rib-spi-config/pom.xml b/bgp/rib-spi-config/pom.xml
new file mode 100644 (file)
index 0000000..f0ffb44
--- /dev/null
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>bgp-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>bgp-rib-spi-config</artifactId>
+   <description>BGP RIB API CONFIG</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.bgp.rib.spi
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-RIB-SPI-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/bgp/rib-spi-config/src/main/yang/config-bgp-rib-spi.yang b/bgp/rib-spi-config/src/main/yang/config-bgp-rib-spi.yang
new file mode 100644 (file)
index 0000000..5c76a0e
--- /dev/null
@@ -0,0 +1,47 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-bgp-rib-spi {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi";
+    prefix "bgpribspi";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP listener service.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity consumer-extensions {
+        description
+            "Service representing a BGP RIB extension registry. Extension
+            consumers have this service injected.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext";
+    }
+
+    identity extensions {
+        description
+            "Service representing a BGP RIB extension registry. Extension
+            providers have this service injected for registration.";
+
+        base "consumer-extensions";
+        config:java-class "org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext";
+    }
+}
+
index 0497567f4f370255d766a7f924a0a8058e224c95..7c7e0de15ed20b08ea70482c1ad5c82fd349e9a5 100644 (file)
@@ -8,6 +8,6 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 public interface RIBExtensionProviderActivator {
-       public void startRIBExtensionProvider(RIBExtensionProviderContext context) throws Exception;
-       public void stopRIBExtensionProvider(RIBExtensionProviderContext context) throws Exception;
+       public void startRIBExtensionProvider(RIBExtensionProviderContext context);
+       public void stopRIBExtensionProvider();
 }
diff --git a/bgp/topology-provider-config/.project b/bgp/topology-provider-config/.project
new file mode 100644 (file)
index 0000000..e14961b
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>bgp-topology-provider-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/bgp/topology-provider-config/pom.xml b/bgp/topology-provider-config/pom.xml
new file mode 100644 (file)
index 0000000..894add4
--- /dev/null
@@ -0,0 +1,103 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>bgp-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>bgp-topology-provider-config</artifactId>
+   <description>BGP Topology provider CONFIG</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-topology-provider</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>sal-binding-config</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.bgp.topology.provider
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-TOPOLOGY-PROVIDER-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModule.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModule.java
new file mode 100644 (file)
index 0000000..a4c6dd5
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-reachability-ipv4
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 19 15:13:57 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
+import org.opendaylight.bgpcep.topology.provider.bgp.AbstractTopologyBuilder;
+import org.opendaylight.bgpcep.topology.provider.bgp.Ipv4ReachabilityTopologyBuilder;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+
+/**
+ *
+ */
+public final class Ipv4ReachabilityTopologyBuilderModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractIpv4ReachabilityTopologyBuilderModule
+{
+
+       public Ipv4ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public Ipv4ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final Ipv4ReachabilityTopologyBuilderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final Ipv4ReachabilityTopologyBuilder b = new Ipv4ReachabilityTopologyBuilder(getDataProviderDependency(), getTopologyId());
+               final InstanceIdentifier<Tables> i = AbstractTopologyBuilder.tableInstanceIdentifier(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+               final ListenerRegistration<DataChangeListener> r = getDataProviderDependency().registerDataChangeListener(i, b);
+
+               final class TopologyReferenceAutocloseable extends DefaultTopologyReference implements AutoCloseable {
+                       public TopologyReferenceAutocloseable(final InstanceIdentifier<Topology> instanceIdentifier) {
+                               super(instanceIdentifier);
+                       }
+
+                       @Override
+                       public void close() throws Exception {
+                               try {
+                                       r.close();
+                               } finally {
+                                       b.close();
+                               }
+                       }
+               }
+
+               return new TopologyReferenceAutocloseable(b.getInstanceIdentifier());
+       }
+}
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModuleFactory.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv4ReachabilityTopologyBuilderModuleFactory.java
new file mode 100644 (file)
index 0000000..c243e30
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-reachability-ipv4
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Nov 19 15:13:57 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+/**
+*
+*/
+public class Ipv4ReachabilityTopologyBuilderModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractIpv4ReachabilityTopologyBuilderModuleFactory
+{
+
+
+}
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModule.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModule.java
new file mode 100644 (file)
index 0000000..b6d6e2a
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-reachability-ipv6
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 19 15:13:57 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
+import org.opendaylight.bgpcep.topology.provider.bgp.AbstractTopologyBuilder;
+import org.opendaylight.bgpcep.topology.provider.bgp.Ipv6ReachabilityTopologyBuilder;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ *
+ */
+public final class Ipv6ReachabilityTopologyBuilderModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractIpv6ReachabilityTopologyBuilderModule
+{
+
+       public Ipv6ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public Ipv6ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final Ipv6ReachabilityTopologyBuilderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final Ipv6ReachabilityTopologyBuilder b = new Ipv6ReachabilityTopologyBuilder(getDataProviderDependency(), getTopologyId());
+               final InstanceIdentifier<Tables> i = AbstractTopologyBuilder.tableInstanceIdentifier(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
+               final ListenerRegistration<DataChangeListener> r = getDataProviderDependency().registerDataChangeListener(i, b);
+
+               final class TopologyReferenceAutocloseable extends DefaultTopologyReference implements AutoCloseable {
+                       public TopologyReferenceAutocloseable(final InstanceIdentifier<Topology> instanceIdentifier) {
+                               super(instanceIdentifier);
+                       }
+
+                       @Override
+                       public void close() throws Exception {
+                               try {
+                                       r.close();
+                               } finally {
+                                       b.close();
+                               }
+                       }
+               }
+
+               return new TopologyReferenceAutocloseable(b.getInstanceIdentifier());
+       }
+}
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModuleFactory.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/Ipv6ReachabilityTopologyBuilderModuleFactory.java
new file mode 100644 (file)
index 0000000..e5aa3f9
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-reachability-ipv6
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Nov 19 15:13:57 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+/**
+*
+*/
+public class Ipv6ReachabilityTopologyBuilderModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractIpv6ReachabilityTopologyBuilderModuleFactory
+{
+
+
+}
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModule.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModule.java
new file mode 100644 (file)
index 0000000..7848561
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-linkstate-topology
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 19 15:22:41 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
+import org.opendaylight.bgpcep.topology.provider.bgp.AbstractTopologyBuilder;
+import org.opendaylight.bgpcep.topology.provider.bgp.LinkstateTopologyBuilder;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+
+/**
+ *
+ */
+public final class LinkstateTopologyBuilderModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractLinkstateTopologyBuilderModule
+{
+
+       public LinkstateTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public LinkstateTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final LinkstateTopologyBuilderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final LinkstateTopologyBuilder b = new LinkstateTopologyBuilder(getDataProviderDependency(), getTopologyId());
+               final InstanceIdentifier<Tables> i = AbstractTopologyBuilder.tableInstanceIdentifier(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class);
+               final ListenerRegistration<DataChangeListener> r = getDataProviderDependency().registerDataChangeListener(i, b);
+
+               final class TopologyReferenceAutocloseable extends DefaultTopologyReference implements AutoCloseable {
+                       public TopologyReferenceAutocloseable(final InstanceIdentifier<Topology> instanceIdentifier) {
+                               super(instanceIdentifier);
+                       }
+
+                       @Override
+                       public void close() throws Exception {
+                               try {
+                                       r.close();
+                               } finally {
+                                       b.close();
+                               }
+                       }
+               }
+
+               return new TopologyReferenceAutocloseable(b.getInstanceIdentifier());
+       }
+}
diff --git a/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModuleFactory.java b/bgp/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/spi/LinkstateTopologyBuilderModuleFactory.java
new file mode 100644 (file)
index 0000000..d3dcbd0
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-linkstate-topology
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Nov 19 15:22:41 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.bgp.rib.spi;
+
+/**
+*
+*/
+public class LinkstateTopologyBuilderModuleFactory extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractLinkstateTopologyBuilderModuleFactory
+{
+
+
+}
diff --git a/bgp/topology-provider-config/src/main/yang/config-bgp-topology-provider.yang b/bgp/topology-provider-config/src/main/yang/config-bgp-topology-provider.yang
new file mode 100644 (file)
index 0000000..7863811
--- /dev/null
@@ -0,0 +1,110 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-bgp-topology-provider {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:spi";
+    prefix "bgptopo";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import config-topology-api { prefix topo; revision-date 2013-11-15; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP topology provider.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity bgp-reachability-ipv4 {
+        base config:module-type;
+        config:provided-service topo:topology-reference;
+        config:java-name-prefix Ipv4ReachabilityTopologyBuilder;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-reachability-ipv4 {
+            when "/config:modules/config:module/config:type = 'bgp-reachability-ipv4'";
+
+            container data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+
+            leaf topology-id {
+                type nt:topology-id;
+                mandatory true;
+            }
+        }
+    }
+
+    identity bgp-reachability-ipv6 {
+        base config:module-type;
+        config:provided-service topo:topology-reference;
+        config:java-name-prefix Ipv6ReachabilityTopologyBuilder;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-reachability-ipv6 {
+            when "/config:modules/config:module/config:type = 'bgp-reachability-ipv6'";
+
+            container data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+
+            leaf topology-id {
+                type nt:topology-id;
+                mandatory true;
+            }
+        }
+    }
+
+    identity bgp-linkstate-topology {
+        base config:module-type;
+        config:provided-service topo:topology-reference;
+        config:java-name-prefix LinkstateTopologyBuilder;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-linkstate-topology {
+            when "/config:modules/config:module/config:type = 'bgp-linkstate-topology'";
+
+            container data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+
+            leaf topology-id {
+                type nt:topology-id;
+                mandatory true;
+            }
+        }
+    }
+}
+
index 3db7f0024e409e83f25c156dc6c22d9625ff6959..5c7069898fc14f6794fa9f9ad7d27259cfc4236f 100644 (file)
                        <Export-Package>
                            org.opendaylight.bgpcep.topology.provider.bgp
                        </Export-Package>
-                       <Private-Package>
-                           org.opendaylight.bgpcep.topology.provider.bgp.impl
-                       </Private-Package>
-                       <Bundle-Activator>org.opendaylight.bgpcep.topology.provider.bgp.impl.Activator</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
@@ -5,12 +5,12 @@
  * 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.bgpcep.topology.provider.bgp.impl;
+package org.opendaylight.bgpcep.topology.provider.bgp;
 
 import java.util.ArrayList;
 
-import org.opendaylight.bgpcep.topology.provider.bgp.AbstractLocRIBListener;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.route.Attributes;
@@ -20,7 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.c.ipv4.next.hop.Ipv4NextHop;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.c.ipv6.next.hop.Ipv6NextHop;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.Node1;
@@ -37,11 +37,11 @@ import org.slf4j.LoggerFactory;
 /**
  *
  */
-abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends AbstractLocRIBListener<T> {
+abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends AbstractTopologyBuilder<T> {
        private static final Logger LOG = LoggerFactory.getLogger(AbstractReachabilityTopologyBuilder.class);
 
-       protected AbstractReachabilityTopologyBuilder(final InstanceIdentifier<Topology> topology, final Class<T> idClass) {
-               super(topology, idClass);
+       protected AbstractReachabilityTopologyBuilder(final DataProviderService dataProvider, final TopologyId topologyId, final Class<T> idClass) {
+               super(dataProvider, topologyId, idClass);
        }
 
        private NodeId advertizingNode(final Attributes attrs) {
@@ -61,7 +61,7 @@ abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends Abst
        }
 
        private InstanceIdentifier<Node1> nodeInstanceId(final NodeId ni) {
-               return InstanceIdentifier.builder(getTopology()).child(Node.class, new NodeKey(ni)).augmentation(Node1.class).toInstance();
+               return InstanceIdentifier.builder(getInstanceIdentifier()).child(Node.class, new NodeKey(ni)).augmentation(Node1.class).toInstance();
        }
 
        private InstanceIdentifier<Node1> ensureNodePresent(final DataModification<InstanceIdentifier<?>, DataObject> trans,
@@ -118,4 +118,5 @@ abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends Abst
 
                removeEmptyNode(trans, nii);
        }
+
 }
similarity index 56%
rename from bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/AbstractLocRIBListener.java
rename to bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/AbstractTopologyBuilder.java
index a212c829e627faf9e1550ccff733a24fe48863eb..03fd1c20b5d8f428602c7099c1e52a1a0f15db39 100644 (file)
@@ -11,12 +11,23 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.opendaylight.bgpcep.topology.TopologyReference;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.protocol.concepts.InstanceIdentifierUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.LocRib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -28,18 +39,22 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 
-public abstract class AbstractLocRIBListener<T extends Route> implements LocRIBListener {
-       private static final Logger LOG = LoggerFactory.getLogger(AbstractLocRIBListener.class);
+public abstract class AbstractTopologyBuilder<T extends Route> implements AutoCloseable, DataChangeListener, LocRIBListener, TopologyReference {
+       private static final InstanceIdentifier<LocRib> locRIBPath = InstanceIdentifier.builder().node(LocRib.class).toInstance();
+       private static final Logger LOG = LoggerFactory.getLogger(AbstractTopologyBuilder.class);
        private final InstanceIdentifier<Topology> topology;
+       private final DataProviderService dataProvider;
        private final Class<T> idClass;
 
-       protected AbstractLocRIBListener(final InstanceIdentifier<Topology> topology, final Class<T> idClass) {
-               this.topology = Preconditions.checkNotNull(topology);
+       protected AbstractTopologyBuilder(final DataProviderService dataProvider, final TopologyId topologyId, final Class<T> idClass) {
+               this.dataProvider = Preconditions.checkNotNull(dataProvider);
+               this.topology = InstanceIdentifier.builder().node(Topology.class, new TopologyKey(Preconditions.checkNotNull(topologyId))).toInstance();
                this.idClass = Preconditions.checkNotNull(idClass);
        }
 
-       public final InstanceIdentifier<Topology> getTopology() {
-               return topology;
+       public static final InstanceIdentifier<Tables> tableInstanceIdentifier(
+                       final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+               return InstanceIdentifier.builder(locRIBPath).child(Tables.class, new TablesKey(afi, safi)).toInstance();
        }
 
        protected abstract void createObject(DataModification<InstanceIdentifier<?>, DataObject> trans, InstanceIdentifier<T> id, T value);
@@ -49,6 +64,15 @@ public abstract class AbstractLocRIBListener<T extends Route> implements LocRIBL
                return InstanceIdentifierUtil.firstIdentifierOf(id, idClass);
        }
 
+       public final DataProviderService getDataProvider() {
+               return dataProvider;
+       }
+
+       @Override
+       public final InstanceIdentifier<Topology> getInstanceIdentifier() {
+               return topology;
+       }
+
        @Override
        public final void onLocRIBChange(final DataModification<InstanceIdentifier<?>, DataObject> trans,
                        final DataChangeEvent<InstanceIdentifier<?>, DataObject> event) {
@@ -88,8 +112,28 @@ public abstract class AbstractLocRIBListener<T extends Route> implements LocRIBL
 
                        @Override
                        public void onFailure(final Throwable t) {
-                               LOG.error("Failed to propagate change by listener {}", AbstractLocRIBListener.this);
+                               LOG.error("Failed to propagate change by listener {}", AbstractTopologyBuilder.this);
                        }
                });
        }
+
+       @Override
+       public final void close() throws Exception {
+               final DataModificationTransaction trans = dataProvider.beginTransaction();
+               trans.removeOperationalData(getInstanceIdentifier());
+               trans.commit().get();
+       }
+
+       @Override
+       public final void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+               final DataModificationTransaction trans = dataProvider.beginTransaction();
+
+               try {
+                       onLocRIBChange(trans, change);
+               } catch (Exception e) {
+                       LOG.info("Data change {} was not completely propagated to listener {}", change, this, e);
+               }
+
+               // FIXME: abort the transaction if it's not committing?
+       }
 }
@@ -5,17 +5,17 @@
  * 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.bgpcep.topology.provider.bgp.impl;
+package org.opendaylight.bgpcep.topology.provider.bgp;
 
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.routes.ipv4.routes.Ipv4Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.route.Attributes;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 
-final class Ipv4ReachabilityTopologyBuilder extends AbstractReachabilityTopologyBuilder<Ipv4Route> {
-       Ipv4ReachabilityTopologyBuilder(final InstanceIdentifier<Topology> topology) {
-               super(topology, Ipv4Route.class);
+public final class Ipv4ReachabilityTopologyBuilder extends AbstractReachabilityTopologyBuilder<Ipv4Route> {
+       public Ipv4ReachabilityTopologyBuilder(final DataProviderService dataProvider, final TopologyId topologyId) {
+               super(dataProvider, topologyId, Ipv4Route.class);
        }
 
        @Override
@@ -5,17 +5,17 @@
  * 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.bgpcep.topology.provider.bgp.impl;
+package org.opendaylight.bgpcep.topology.provider.bgp;
 
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.routes.ipv6.routes.Ipv6Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.route.Attributes;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 
-final class Ipv6ReachabilityTopologyBuilder extends AbstractReachabilityTopologyBuilder<Ipv6Route> {
-       Ipv6ReachabilityTopologyBuilder(final InstanceIdentifier<Topology> topology) {
-               super(topology, Ipv6Route.class);
+public final class Ipv6ReachabilityTopologyBuilder extends AbstractReachabilityTopologyBuilder<Ipv6Route> {
+       public Ipv6ReachabilityTopologyBuilder(final DataProviderService dataProvider, final TopologyId topologyId) {
+               super(dataProvider, topologyId, Ipv6Route.class);
        }
 
        @Override
@@ -5,15 +5,15 @@
  * 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.bgpcep.topology.provider.bgp.impl;
+package org.opendaylight.bgpcep.topology.provider.bgp;
 
 import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.bgpcep.topology.provider.bgp.AbstractLocRIBListener;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.NodeIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.TopologyIdentifier;
@@ -41,7 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev13
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.ted.link.attributes.UnreservedBandwidthKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
@@ -63,9 +63,9 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 
-final class LinkstateTopologyBuilder extends AbstractLocRIBListener<LinkstateRoute> {
-       LinkstateTopologyBuilder(final InstanceIdentifier<Topology> topology) {
-               super(topology, LinkstateRoute.class);
+public final class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateRoute> {
+       public LinkstateTopologyBuilder(final DataProviderService dataProvider, final TopologyId topologyId) {
+               super(dataProvider, topologyId, LinkstateRoute.class);
        }
 
        private String buildNamePrefix(final LinkstateRoute route) {
@@ -95,7 +95,7 @@ final class LinkstateTopologyBuilder extends AbstractLocRIBListener<LinkstateRou
        }
 
        private InstanceIdentifier<?> buildLinkIdentifier(final String pfx, final Link l) {
-               return InstanceIdentifier.builder(getTopology()).node(
+               return InstanceIdentifier.builder(getInstanceIdentifier()).node(
                                org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link.class,
                                new LinkKey(buildLinkId(pfx, l))).toInstance();
        }
@@ -190,7 +190,7 @@ final class LinkstateTopologyBuilder extends AbstractLocRIBListener<LinkstateRou
        }
 
        private InstanceIdentifierBuilder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> nodeIdentifierBuilder(final String pfx, final NodeIdentifier node) {
-               return InstanceIdentifier.builder(getTopology()).node(
+               return InstanceIdentifier.builder(getInstanceIdentifier()).node(
                                org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.class,
                                new NodeKey(buildNodeId(pfx, node)));
        }
diff --git a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/LocRIBListeners.java b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/LocRIBListeners.java
deleted file mode 100644 (file)
index cf8340b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.opendaylight.bgpcep.topology.provider.bgp;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-public final class LocRIBListeners {
-       public interface Subscribtion {
-               public Class<? extends AddressFamily> getAfi();
-               public Class<? extends SubsequentAddressFamily> getSafi();
-               public LocRIBListener getLocRIBListener();
-       }
-
-       private LocRIBListeners() {
-
-       }
-
-       public static ServiceRegistration<Subscribtion> subscribe(final BundleContext context,
-                       final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final LocRIBListener listener) {
-               return context.registerService(Subscribtion.class,
-                               new Subscribtion() {
-                       @Override
-                       public Class<? extends AddressFamily> getAfi() {
-                               return afi;
-                       }
-
-                       @Override
-                       public Class<? extends SubsequentAddressFamily> getSafi() {
-                               return safi;
-                       }
-
-                       @Override
-                       public LocRIBListener getLocRIBListener() {
-                               return listener;
-                       }
-               }, null);
-       }
-}
diff --git a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/Activator.java b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/Activator.java
deleted file mode 100644 (file)
index aaaedad..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.topology.provider.bgp.impl;
-
-import org.opendaylight.bgpcep.topology.provider.bgp.LocRIBListeners;
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-import com.google.common.base.Preconditions;
-
-public class Activator extends AbstractBindingAwareProvider {
-       private ServiceRegistration<LocRIBListeners.Subscribtion> ipv4, ipv6, linkstate;
-       private BundleContext context;
-
-       @Override
-       public void onSessionInitiated(final ProviderContext session) {
-               final LocRIBListenerSubscriptionTracker reg = new LocRIBListenerSubscriptionTracker(context, session.getSALService(DataProviderService.class));
-               reg.open();
-
-               ipv4 = LocRIBListeners.subscribe(context, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
-                               new Ipv4ReachabilityTopologyBuilder(null));
-               ipv6 = LocRIBListeners.subscribe(context, Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class,
-                               new Ipv6ReachabilityTopologyBuilder(null));
-               linkstate = LocRIBListeners.subscribe(context, LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class,
-                               new LinkstateTopologyBuilder(null));
-       }
-
-       @Override
-       protected void startImpl(final BundleContext context) {
-               this.context = Preconditions.checkNotNull(context);
-       }
-}
diff --git a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/LocRIBListenerSubscriptionTracker.java b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/topology/provider/bgp/impl/LocRIBListenerSubscriptionTracker.java
deleted file mode 100644 (file)
index 45ac8f8..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.topology.provider.bgp.impl;
-
-import org.opendaylight.bgpcep.topology.provider.bgp.LocRIBListener;
-import org.opendaylight.bgpcep.topology.provider.bgp.LocRIBListeners;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.LocRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-final class LocRIBListenerSubscriptionTracker extends ServiceTracker<LocRIBListeners.Subscribtion, ListenerRegistration<LocRIBListener>> {
-       private static final InstanceIdentifier<LocRib> locRIBPath = InstanceIdentifier.builder().node(LocRib.class).toInstance();
-       private static final Logger LOG = LoggerFactory.getLogger(LocRIBListenerSubscriptionTracker.class);
-       private final DataProviderService dps;
-
-       LocRIBListenerSubscriptionTracker(final BundleContext context, final DataProviderService dps) {
-               super(context, LocRIBListeners.Subscribtion.class, null);
-               this.dps = Preconditions.checkNotNull(dps);
-       }
-
-       @Override
-       public ListenerRegistration<LocRIBListener> addingService(final ServiceReference<LocRIBListeners.Subscribtion> reference) {
-               final LocRIBListeners.Subscribtion service = context.getService(reference);
-               if (service == null) {
-                       LOG.trace("Service for reference {} disappeared", reference);
-                       return null;
-               }
-
-               final InstanceIdentifier<Tables> path = InstanceIdentifier.builder(locRIBPath).
-                               child(Tables.class, new TablesKey(service.getAfi(), service.getSafi())).toInstance();
-               final LocRIBListener listener = service.getLocRIBListener();
-
-               final DataChangeListener dcl = new DataChangeListener() {
-
-                       @Override
-                       public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
-                               final DataModificationTransaction trans = dps.beginTransaction();
-
-                               try {
-                                       listener.onLocRIBChange(trans, change);
-                               } catch (Exception e) {
-                                       LOG.info("Data change {} was not completely propagated to listener {}", change, listener, e);
-                               }
-
-                               // FIXME: abort the transaction if it's not committing
-                       }
-               };
-
-               final ListenerRegistration<DataChangeListener> reg = dps.registerDataChangeListener(path, dcl);
-
-               return new ListenerRegistration<LocRIBListener>() {
-                       @Override
-                       public void close() throws Exception {
-                               reg.close();
-                       }
-
-                       @Override
-                       public LocRIBListener getInstance() {
-                               return listener;
-                       }
-               };
-       }
-
-       @Override
-       public void removedService(final ServiceReference<LocRIBListeners.Subscribtion> reference, final ListenerRegistration<LocRIBListener> service) {
-               try {
-                       service.close();
-               } catch (Exception e) {
-                       LOG.error("Failed to unregister service {}", service, e);
-               }
-               context.ungetService(reference);
-       }
-}
diff --git a/concepts/src/main/java/org/opendaylight/protocol/concepts/DefaultInstanceReference.java b/concepts/src/main/java/org/opendaylight/protocol/concepts/DefaultInstanceReference.java
new file mode 100644 (file)
index 0000000..b65ad30
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.concepts;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Preconditions;
+
+/**
+ *
+ */
+public class DefaultInstanceReference<T extends DataObject> implements InstanceReference<T> {
+       private final InstanceIdentifier<T> instanceIdentifier;
+
+       public DefaultInstanceReference(final InstanceIdentifier<T> instanceIdentifier) {
+               this.instanceIdentifier = Preconditions.checkNotNull(instanceIdentifier);
+       }
+
+       @Override
+       public final InstanceIdentifier<T> getInstanceIdentifier() {
+               return instanceIdentifier;
+       }
+}
diff --git a/concepts/src/main/java/org/opendaylight/protocol/concepts/InstanceReference.java b/concepts/src/main/java/org/opendaylight/protocol/concepts/InstanceReference.java
new file mode 100644 (file)
index 0000000..3a135cd
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.concepts;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * A reference to an object identified by an InstanceIdentifier.
+ */
+public interface InstanceReference<T extends DataObject> {
+       /**
+        * Returns the InstanceIdentifier of the object.
+        * 
+        * @return instance identifier
+        */
+       InstanceIdentifier<T> getInstanceIdentifier();
+}
index ed8f388aa64ca8cc8d013255aca19a837b398ca8..67acc26155f48ad407a34b1c33201b76bcd8df8c 100644 (file)
          <artifactId>pcep-api-config</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
       <dependency>
          <groupId>org.opendaylight.controller</groupId>
          <artifactId>threadpool-config-api</artifactId>
          <url>${basedir}/target/site/${project.artifactId}</url>
       </site>
    </distributionManagement>
-</project>
\ No newline at end of file
+</project>
index c338b63db6f433142578b858f0de504b94a9234d..59ba9348c6d2251e5d2b04dfd782892f08358160 100644 (file)
@@ -15,27 +15,26 @@ import io.netty.util.Timer;
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
 import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
 
 /**
-*
-*/
+ *
+ */
 public final class PCEPDispatcherImplModule
-               extends
-               org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModule {
+extends
+org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModule {
 
        public PCEPDispatcherImplModule(
-                       org.opendaylight.controller.config.api.ModuleIdentifier name,
-                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+                       final org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
                super(name, dependencyResolver);
        }
 
        public PCEPDispatcherImplModule(
-                       org.opendaylight.controller.config.api.ModuleIdentifier name,
-                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-                       PCEPDispatcherImplModule oldModule,
-                       java.lang.AutoCloseable oldInstance) {
+                       final org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       final PCEPDispatcherImplModule oldModule,
+                       final java.lang.AutoCloseable oldInstance) {
                super(name, dependencyResolver, oldModule, oldInstance);
        }
 
@@ -47,7 +46,7 @@ public final class PCEPDispatcherImplModule
                JmxAttributeValidationException.checkCondition(
                                getMaxUnknownMessages() > 0, "Parameter 'maxUnknownMessages' "
                                                + "must be greater than 0",
-                               this.maxUnknownMessagesJmxAttribute);
+                                               this.maxUnknownMessagesJmxAttribute);
        }
 
        @Override
@@ -59,9 +58,8 @@ public final class PCEPDispatcherImplModule
                                timer, localPrefs, getMaxUnknownMessages());
 
                final PCEPDispatcherImpl instance = new PCEPDispatcherImpl(
-                               PCEPExtensionProviderContextImpl.getSingletonInstance()
-                                               .getMessageHandlerRegistry(), negFactory,
-                               getBossGroupDependency(), getWorkerGroupDependency());
+                               getExtensionsDependency().getMessageHandlerRegistry(),
+                               negFactory, getBossGroupDependency(), getWorkerGroupDependency());
                return instance;
        }
 }
index 419cd72401013a9ba6494e0e75ddd3554cc356a1..31ec5053050db8db8cf35ffe4d451c05a95e59c7 100644 (file)
@@ -6,6 +6,7 @@ module pcep-impl {
 
     import config { prefix config; revision-date 2013-04-05; }
     import pcep { prefix pcep; revision-date 2013-04-09; }
+    import config-pcep-spi { prefix spi; revision-date 2013-11-15; }
     import threadpool { prefix th; revision-date 2013-04-09; }
 
     organization "Cisco Systems, Inc.";
@@ -47,6 +48,15 @@ module pcep-impl {
                                type uint16;
                        }
 
+                       container extensions {
+                               uses config:service-ref {
+                                       refine type {
+                                               mandatory true;
+                                               config:required-identity spi:consumer-extensions;
+                                       }
+                               }
+                       }
+
                        container pcep-session-proposal-factory {
                                uses config:service-ref {
                                        refine type {
@@ -118,7 +128,5 @@ module pcep-impl {
                        }
                }
        }
-
-
 }
 
index 4571cb24c8fa60b02c2a463a9528722351ee01a9..381473c3f27c5840214ab005f4532b397774e222 100644 (file)
@@ -17,6 +17,8 @@ import org.opendaylight.controller.config.manager.impl.factoriesresolver.Hardcod
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
 import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
+import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
+import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleMXBean;
 
 public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
 
@@ -28,13 +30,16 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
 
        private NettyThreadgroupModuleFactory threadgroupFactory;
 
+       private SimplePCEPExtensionProviderContextModuleFactory extensionsFactory;
+
        @Before
        public void setUp() throws Exception {
                this.factory = new PCEPDispatcherImplModuleFactory();
                this.sessionFactory = new PCEPSessionProposalFactoryImplModuleFactory();
                this.threadgroupFactory = new NettyThreadgroupModuleFactory();
+               this.extensionsFactory = new SimplePCEPExtensionProviderContextModuleFactory();
                super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
-                               factory, sessionFactory, threadgroupFactory));
+                               factory, sessionFactory, threadgroupFactory, extensionsFactory));
        }
 
        @Test
@@ -46,7 +51,8 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
                        createInstance(transaction, this.factory.getImplementationName(),
                                        instanceName, null,
                                        this.sessionFactory.getImplementationName(),
-                                       this.threadgroupFactory.getImplementationName());
+                                       this.threadgroupFactory.getImplementationName(),
+                                       this.extensionsFactory.getImplementationName());
                        transaction.validateConfig();
                        fail();
                } catch (ValidationException e) {
@@ -63,7 +69,8 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
                        createInstance(transaction, this.factory.getImplementationName(),
                                        instanceName, 0,
                                        this.sessionFactory.getImplementationName(),
-                                       this.threadgroupFactory.getImplementationName());
+                                       this.threadgroupFactory.getImplementationName(),
+                                       this.extensionsFactory.getImplementationName());
                        transaction.validateConfig();
                        fail();
                } catch (ValidationException e) {
@@ -77,49 +84,51 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
                                .createTransaction();
                createInstance(transaction, this.factory.getImplementationName(),
                                instanceName, 5, this.sessionFactory.getImplementationName(),
-                               this.threadgroupFactory.getImplementationName());
+                               this.threadgroupFactory.getImplementationName(),
+                               this.extensionsFactory.getImplementationName());
                transaction.validateConfig();
                CommitStatus status = transaction.commit();
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 4, 0, 0);
+               assertStatus(status, 5, 0, 0);
        }
 
        @Test
        public void testReusingOldInstance() throws InstanceAlreadyExistsException,
-                       ConflictingVersionException, ValidationException {
+       ConflictingVersionException, ValidationException {
                ConfigTransactionJMXClient transaction = configRegistryClient
                                .createTransaction();
                createInstance(transaction, this.factory.getImplementationName(),
                                instanceName, 5, this.sessionFactory.getImplementationName(),
-                               this.threadgroupFactory.getImplementationName());
+                               this.threadgroupFactory.getImplementationName(), this.extensionsFactory.getImplementationName());
                transaction.commit();
                transaction = configRegistryClient.createTransaction();
                assertBeanCount(1, factory.getImplementationName());
                CommitStatus status = transaction.commit();
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 0, 0, 4);
+               assertStatus(status, 0, 0, 5);
        }
 
        @Test
        public void testReconfigure() throws InstanceAlreadyExistsException,
-                       ConflictingVersionException, ValidationException,
-                       InstanceNotFoundException {
+       ConflictingVersionException, ValidationException,
+       InstanceNotFoundException {
                ConfigTransactionJMXClient transaction = configRegistryClient
                                .createTransaction();
                createInstance(transaction, this.factory.getImplementationName(),
                                instanceName, 5, this.sessionFactory.getImplementationName(),
-                               this.threadgroupFactory.getImplementationName());
+                               this.threadgroupFactory.getImplementationName(),
+                               this.extensionsFactory.getImplementationName());
                transaction.commit();
                transaction = configRegistryClient.createTransaction();
                assertBeanCount(1, factory.getImplementationName());
                PCEPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
                                transaction.lookupConfigBean(
                                                this.factory.getImplementationName(), instanceName),
-                               PCEPDispatcherImplModuleMXBean.class);
+                                               PCEPDispatcherImplModuleMXBean.class);
                mxBean.setMaxUnknownMessages(10);
                CommitStatus status = transaction.commit();
                assertBeanCount(1, factory.getImplementationName());
-               assertStatus(status, 0, 1, 3);
+               assertStatus(status, 0, 1, 4);
        }
 
        public static ObjectName createInstance(
@@ -127,8 +136,9 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
                        final String moduleName, final String instanceName,
                        final Integer maxUnknownMessages,
                        final String sessionFactoryImplName,
-                       final String threadGrupFactoryImplName)
-                       throws InstanceAlreadyExistsException {
+                       final String threadGroupFactoryImplName,
+                       final String extensionsImplName)
+                                       throws InstanceAlreadyExistsException {
                ObjectName nameCreated = transaction.createModule(moduleName,
                                instanceName);
                PCEPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
@@ -138,9 +148,22 @@ public class PCEPDispatcherImplModuleTest extends AbstractConfigTest {
                                                "pcep-proposal", 0, 0, true, true, true, true, 1000));
                mxBean.setMaxUnknownMessages(maxUnknownMessages);
                mxBean.setBossGroup(createThreadGroupInstance(transaction,
-                               threadGrupFactoryImplName, "boss-group", 10));
+                               threadGroupFactoryImplName, "boss-group", 10));
                mxBean.setWorkerGroup(createThreadGroupInstance(transaction,
-                               threadGrupFactoryImplName, "worker-group", 10));
+                               threadGroupFactoryImplName, "worker-group", 10));
+               mxBean.setExtensions(createExtensionsInstance(transaction,
+                               extensionsImplName, "extensions"));
+               return nameCreated;
+       }
+
+       public static ObjectName createExtensionsInstance(
+                       final ConfigTransactionJMXClient transaction,
+                       final String moduleName, final String instanceName) throws InstanceAlreadyExistsException {
+               ObjectName nameCreated = transaction.createModule(moduleName,
+                               instanceName);
+               SimplePCEPExtensionProviderContextModuleMXBean mxBean = transaction.newMBeanProxy(
+                               nameCreated, SimplePCEPExtensionProviderContextModuleMXBean.class);
+
                return nameCreated;
        }
 
index f11f7ac25f5799572cf5a23acde4994208aa94fa..638380c9cc6f9c28fccbe9860420059fe8c1f809 100644 (file)
                                                <Private-Package>
                                                        org.opendaylight.protocol.pcep.impl.*,
                                                </Private-Package>
-                        <Activator>org.opendaylight.protocol.pcep.parser.impl.BundleActivator</Activator>
                                        </instructions>
                                </configuration>
                        </plugin>
diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/BundleActivator.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/BundleActivator.java
deleted file mode 100644 (file)
index 7318b7f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep.impl;
-
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.osgi.AbstractOSGiPCEPExtensionProviderActivator;
-
-public final class BundleActivator extends AbstractOSGiPCEPExtensionProviderActivator {
-       private final PCEPExtensionProviderActivator activator = new Activator();
-
-       @Override
-       public void start(final PCEPExtensionProviderContext context) throws Exception {
-               activator.start(context);
-       }
-
-       @Override
-       public void stop() throws Exception {
-               activator.stop();
-       }
-}
index 6e5d6f452b04c17c128b69a7d4d487a5fe376e80..395ffde4c682faca11f0c3c8013e0f4f0b1913f7 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.protocol.pcep.impl.subobject.EROIpPrefixSubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.EROLabelSubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.EROPathKeySubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.EROUnnumberedInterfaceSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
@@ -41,15 +41,15 @@ import com.google.common.collect.Lists;
 public class PCEPEROSubobjectParserTest {
        private static final byte[] ip4PrefixBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x00 };
        private static final byte[] ip6PrefixBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0x16, (byte) 0x00 };
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+               (byte) 0xFF, (byte) 0x16, (byte) 0x00 };
        private static final byte[] asNumberBytes = { (byte) 0x00, (byte) 0x64 };
        private static final byte[] unnumberedBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
        private static final byte[] pathKey32Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 };
        private static final byte[] pathKey128Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-                       (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                       (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+               (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+               (byte) 0x00, (byte) 0x00, (byte) 0x00 };
        private static final byte[] labelBytes = { (byte) 0x80, (byte) 0x02, (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF };
        private static final byte[] exrsBytes = { (byte) 0xa0, (byte) 0x04, (byte) 0x00, (byte) 0x64 };
 
@@ -125,7 +125,7 @@ public class PCEPEROSubobjectParserTest {
 
        @Test
        public void testEROLabelSubobject() throws Exception {
-               final EROLabelSubobjectParser parser = new EROLabelSubobjectParser(PCEPExtensionProviderContextImpl.create().getLabelHandlerRegistry());
+               final EROLabelSubobjectParser parser = new EROLabelSubobjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getLabelHandlerRegistry());
                final SubobjectsBuilder subs = new SubobjectsBuilder();
                subs.setLoose(true);
                subs.setSubobjectType(new LabelBuilder().setUniDirectional(true).setLabelType(
@@ -136,7 +136,7 @@ public class PCEPEROSubobjectParserTest {
 
        @Test
        public void testEROEXRSSubobject() throws Exception {
-               final EROExplicitExclusionRouteSubobjectParser parser = new EROExplicitExclusionRouteSubobjectParser(PCEPExtensionProviderContextImpl.create().getXROSubobjectHandlerRegistry());
+               final EROExplicitExclusionRouteSubobjectParser parser = new EROExplicitExclusionRouteSubobjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getXROSubobjectHandlerRegistry());
                final SubobjectsBuilder subs = new SubobjectsBuilder();
                subs.setLoose(true);
                final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.explicit.route.subobjects.subobject.type.exrs.Exrs> list = Lists.newArrayList();
index 2dd08288d5b7a8bfbf3d41526be774a0ab1347a7..b80543bfdeba14ff865ca280beca813b75ff5f78 100644 (file)
@@ -44,7 +44,7 @@ import org.opendaylight.protocol.pcep.impl.object.PCEPSrpObjectParser;
 import org.opendaylight.protocol.pcep.impl.object.PCEPSvecObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
 import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
@@ -119,7 +119,7 @@ public class PCEPObjectParserTest {
 
        @Before
        public void setUp() throws Exception {
-               this.tlvRegistry = PCEPExtensionProviderContextImpl.create().getTlvHandlerRegistry();
+               this.tlvRegistry = ServiceLoaderPCEPExtensionProviderContext.create().getTlvHandlerRegistry();
        }
 
        @Test
@@ -203,7 +203,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testERObject() throws Exception {
-               final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(PCEPExtensionProviderContextImpl.create().getEROSubobjectHandlerRegistry());
+               final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getEROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPExplicitRouteObject1PackOfSubobjects.bin");
 
                final EroBuilder builder = new EroBuilder();
@@ -224,7 +224,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testIRObject() throws Exception {
-               final PCEPIncludeRouteObjectParser parser = new PCEPIncludeRouteObjectParser(PCEPExtensionProviderContextImpl.create().getEROSubobjectHandlerRegistry());
+               final PCEPIncludeRouteObjectParser parser = new PCEPIncludeRouteObjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getEROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin");
                final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
@@ -250,7 +250,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testRRObject() throws Exception {
-               final PCEPReportedRouteObjectParser parser = new PCEPReportedRouteObjectParser(PCEPExtensionProviderContextImpl.create().getRROSubobjectHandlerRegistry());
+               final PCEPReportedRouteObjectParser parser = new PCEPReportedRouteObjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getRROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin");
                final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
@@ -578,7 +578,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testExcludeRouteObject() throws Exception {
-               final PCEPExcludeRouteObjectParser parser = new PCEPExcludeRouteObjectParser(PCEPExtensionProviderContextImpl.create().getXROSubobjectHandlerRegistry());
+               final PCEPExcludeRouteObjectParser parser = new PCEPExcludeRouteObjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getXROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPExcludeRouteObject.1.bin");
 
                final XroBuilder builder = new XroBuilder();
@@ -598,7 +598,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testPathKeyObject() throws Exception {
-               final PCEPPathKeyObjectParser parser = new PCEPPathKeyObjectParser(PCEPExtensionProviderContextImpl.create().getEROSubobjectHandlerRegistry());
+               final PCEPPathKeyObjectParser parser = new PCEPPathKeyObjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getEROSubobjectHandlerRegistry());
                final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPPathKeyObject.bin");
 
                final PathKeyBuilder builder = new PathKeyBuilder();
index fada1ecaaca1fea5e0d76f428d19bfdf932b8ab8..897794c71c063e7a96388e1cf61ce200cad53c03 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.protocol.pcep.impl.subobject.RROIpPrefixSubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.RROLabelSubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.RROPathKeySubobjectParser;
 import org.opendaylight.protocol.pcep.impl.subobject.RROUnnumberedInterfaceSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKey;
@@ -33,14 +33,14 @@ public class PCEPRROSubobjectParserTest {
 
        private static final byte[] ip4PrefixBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x01 };
        private static final byte[] ip6PrefixBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
-                       (byte) 0xFF, (byte) 0x16, (byte) 0x02 };
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+               (byte) 0xFF, (byte) 0x16, (byte) 0x02 };
        private static final byte[] unnumberedBytes = { (byte) 0x02, (byte) 0x00, (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00,
-                       (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+               (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
        private static final byte[] pathKey32Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 };
        private static final byte[] pathKey128Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-                       (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                       (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+               (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+               (byte) 0x00, (byte) 0x00, (byte) 0x00 };
        private static final byte[] labelBytes = { (byte) 0x81, (byte) 0x02, (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF };
 
        @Test
@@ -106,7 +106,7 @@ public class PCEPRROSubobjectParserTest {
 
        @Test
        public void testRROLabelSubobject() throws Exception {
-               final RROLabelSubobjectParser parser = new RROLabelSubobjectParser(PCEPExtensionProviderContextImpl.create().getLabelHandlerRegistry());
+               final RROLabelSubobjectParser parser = new RROLabelSubobjectParser(ServiceLoaderPCEPExtensionProviderContext.create().getLabelHandlerRegistry());
                final SubobjectsBuilder subs = new SubobjectsBuilder();
                subs.setSubobjectType(new LabelBuilder().setUniDirectional(true).setGlobal(true).setLabelType(
                                new GeneralizedLabelBuilder().setGeneralizedLabel(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }).build()).build());
index b24083a3b3d56d4796083106b6f2db8c31603f94..8dbbf49b25790bf103ef046f3bbc95a0033ee281 100644 (file)
@@ -30,7 +30,7 @@ import org.opendaylight.protocol.pcep.impl.message.PCEPReportMessageParser;
 import org.opendaylight.protocol.pcep.impl.message.PCEPUpdateRequestMessageParser;
 import org.opendaylight.protocol.pcep.impl.message.PcinitiateMessageParser;
 import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder;
@@ -144,7 +144,7 @@ public class PCEPValidatorTest {
 
        @Before
        public void setUp() throws Exception {
-               this.objectRegistry = PCEPExtensionProviderContextImpl.create().getObjectHandlerRegistry();
+               this.objectRegistry = ServiceLoaderPCEPExtensionProviderContext.create().getObjectHandlerRegistry();
                final RpBuilder rpBuilder = new RpBuilder();
                rpBuilder.setProcessingRule(false);
                rpBuilder.setIgnore(false);
index 3fd5ca0632ce6c4c780e98f5b53ad0c3dcc5a6e6..bccc63f913c4a22e6caa22ce5eae8c3f8b17576b 100644 (file)
        
        <modules>
                <module>api</module>
+        <module>api-config</module>
                <module>impl</module>
+        <module>impl-config</module>
                <module>spi</module>
+               <module>spi-config</module>
         <module>testtool</module>
         <module>topology-api</module>
-        <module>topology-provider</module>
-        <module>api-config</module>
-        <module>impl-config</module>
         <module>topology-spi</module>
+        <module>topology-provider</module>
+        <module>topology-provider-config</module>
         <module>tunnel-api</module>
         <module>tunnel-provider</module>
+        <module>tunnel-provider-config</module>
     </modules>
 </project>
diff --git a/pcep/spi-config/.project b/pcep/spi-config/.project
new file mode 100644 (file)
index 0000000..cfb177c
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>pcep-spi-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/pcep/spi-config/pom.xml b/pcep/spi-config/pom.xml
new file mode 100644 (file)
index 0000000..bf7d9d6
--- /dev/null
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>pcep-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>pcep-spi-config</artifactId>
+   <description>PCE Protocol SPI configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.pcep.spi
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PCEP-SPI-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
diff --git a/pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java b/pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModule.java
new file mode 100644 (file)
index 0000000..5631dc9
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-pcep-spi  yang module local name: pcep-extensions-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 14:32:53 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.pcep.spi;
+
+import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
+
+/**
+*
+*/
+public final class SimplePCEPExtensionProviderContextModule extends org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModule
+{
+
+    public SimplePCEPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public SimplePCEPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, SimplePCEPExtensionProviderContextModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void validate(){
+        super.validate();
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+               final class PCEPExtensionProviderContextImplCloseable extends SimplePCEPExtensionProviderContext implements AutoCloseable {
+                       @Override
+                       public void close() {
+                               // Nothing to do
+                       }
+               }
+
+               return new PCEPExtensionProviderContextImplCloseable();
+    }
+}
diff --git a/pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java b/pcep/spi-config/src/main/java/org/opendaylight/controller/config/yang/pcep/spi/SimplePCEPExtensionProviderContextModuleFactory.java
new file mode 100644 (file)
index 0000000..01bb8ed
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-pcep-spi  yang module local name: pcep-extensions-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 14:32:53 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.pcep.spi;
+
+/**
+*
+*/
+public class SimplePCEPExtensionProviderContextModuleFactory extends org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModuleFactory
+{
+
+
+}
diff --git a/pcep/spi-config/src/main/yang/config-pcep-spi.yang b/pcep/spi-config/src/main/yang/config-pcep-spi.yang
new file mode 100644 (file)
index 0000000..2938f8b
--- /dev/null
@@ -0,0 +1,59 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-pcep-spi {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:spi";
+    prefix "spi";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+        PCEP SPI module.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity consumer-extensions {
+        description
+            "Service representing a PCEP parser extension registry. Extension
+            consumers have this service injected.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext";
+    }
+
+    identity extensions {
+        description
+            "Service representing a PCEP parser extension registry. Extension
+            providers have this service injected for registration.";
+
+        base "consumer-extensions";
+        config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext";
+    }
+
+    identity pcep-extensions-impl {
+        base config:module-type;
+        config:provided-service extensions;
+        config:java-name-prefix SimplePCEPExtensionProviderContext;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case pcep-extensions-impl {
+            when "/config:modules/config:module/config:type = 'pcep-extensions-impl'";
+        }
+    }
+}
+
diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/ServiceLoaderPCEPExtensionProviderContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/ServiceLoaderPCEPExtensionProviderContext.java
new file mode 100644 (file)
index 0000000..c8c65b1
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi.pojo;
+
+import java.util.ServiceLoader;
+
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+
+public final class ServiceLoaderPCEPExtensionProviderContext extends SimplePCEPExtensionProviderContext {
+       private static final class Holder {
+               private static final PCEPExtensionProviderContext INSTANCE;
+
+               static {
+                       try {
+                               INSTANCE = create();
+                       } catch (final Exception e) {
+                               throw new ExceptionInInitializerError(e);
+                       }
+               }
+       }
+
+       private ServiceLoaderPCEPExtensionProviderContext() {
+
+       }
+
+       public static PCEPExtensionProviderContext create() throws Exception {
+               final PCEPExtensionProviderContext ctx = new SimplePCEPExtensionProviderContext();
+
+               final ServiceLoader<PCEPExtensionProviderActivator> loader = ServiceLoader.load(PCEPExtensionProviderActivator.class);
+               for (final PCEPExtensionProviderActivator a : loader) {
+                       a.start(ctx);
+               }
+
+               return ctx;
+       }
+
+       public static PCEPExtensionProviderContext getSingletonInstance() {
+               return Holder.INSTANCE;
+       }
+}
similarity index 63%
rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/PCEPExtensionProviderContextImpl.java
rename to pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java
index 6aa4b87f21b491b22920beb3d9f47ebfa80dfdd4..2dd5cd0b47438d6cbb184c43146ef039d03e275e 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
-import java.util.ServiceLoader;
-
 import javax.annotation.concurrent.ThreadSafe;
 
 import org.opendaylight.protocol.pcep.spi.EROSubobjectHandlerRegistry;
@@ -23,7 +21,6 @@ import org.opendaylight.protocol.pcep.spi.MessageSerializer;
 import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.ObjectParser;
 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.RROSubobjectHandlerRegistry;
 import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
@@ -44,19 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
  *
  */
 @ThreadSafe
-public final class PCEPExtensionProviderContextImpl implements PCEPExtensionProviderContext {
-       private static final class Holder {
-               private static final PCEPExtensionProviderContext INSTANCE;
-
-               static {
-                       try {
-                               INSTANCE = PCEPExtensionProviderContextImpl.create();
-                       } catch (final Exception e) {
-                               throw new ExceptionInInitializerError(e);
-                       }
-               }
-       }
-
+public class SimplePCEPExtensionProviderContext implements PCEPExtensionProviderContext {
        private final SimpleLabelHandlerRegistry labelReg = new SimpleLabelHandlerRegistry();
        private final SimpleMessageHandlerRegistry msgReg = new SimpleMessageHandlerRegistry();
        private final SimpleObjectHandlerRegistry objReg = new SimpleObjectHandlerRegistry();
@@ -65,109 +50,89 @@ public final class PCEPExtensionProviderContextImpl implements PCEPExtensionProv
        private final SimpleXROSubobjectHandlerRegistry xroSubReg = new SimpleXROSubobjectHandlerRegistry();
        private final SimpleTlvHandlerRegistry tlvReg = new SimpleTlvHandlerRegistry();
 
-       protected PCEPExtensionProviderContextImpl() {
-
-       }
-
-       public static PCEPExtensionProviderContext create() throws Exception {
-               final PCEPExtensionProviderContext ctx = new PCEPExtensionProviderContextImpl();
-
-               final ServiceLoader<PCEPExtensionProviderActivator> loader = ServiceLoader.load(PCEPExtensionProviderActivator.class);
-               for (final PCEPExtensionProviderActivator a : loader) {
-                       a.start(ctx);
-               }
-
-               return ctx;
-
-       }
-
-       public static PCEPExtensionProviderContext getSingletonInstance() {
-               return Holder.INSTANCE;
-       }
-
        @Override
-       public LabelHandlerRegistry getLabelHandlerRegistry() {
+       public final LabelHandlerRegistry getLabelHandlerRegistry() {
                return this.labelReg;
        }
 
        @Override
-       public MessageHandlerRegistry getMessageHandlerRegistry() {
+       public final MessageHandlerRegistry getMessageHandlerRegistry() {
                return this.msgReg;
        }
 
        @Override
-       public ObjectHandlerRegistry getObjectHandlerRegistry() {
+       public final ObjectHandlerRegistry getObjectHandlerRegistry() {
                return this.objReg;
        }
 
        @Override
-       public EROSubobjectHandlerRegistry getEROSubobjectHandlerRegistry() {
+       public final EROSubobjectHandlerRegistry getEROSubobjectHandlerRegistry() {
                return this.eroSubReg;
        }
 
        @Override
-       public RROSubobjectHandlerRegistry getRROSubobjectHandlerRegistry() {
+       public final RROSubobjectHandlerRegistry getRROSubobjectHandlerRegistry() {
                return this.rroSubReg;
        }
 
        @Override
-       public XROSubobjectHandlerRegistry getXROSubobjectHandlerRegistry() {
+       public final XROSubobjectHandlerRegistry getXROSubobjectHandlerRegistry() {
                return this.xroSubReg;
        }
 
        @Override
-       public TlvHandlerRegistry getTlvHandlerRegistry() {
+       public final TlvHandlerRegistry getTlvHandlerRegistry() {
                return this.tlvReg;
        }
 
        @Override
-       public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
+       public final AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
                return this.labelReg.registerLabelSerializer(labelClass, serializer);
        }
 
        @Override
-       public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
+       public final AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
                return this.labelReg.registerLabelParser(cType, parser);
        }
 
        @Override
-       public AutoCloseable registerEROSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
+       public final AutoCloseable registerEROSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
                return this.eroSubReg.registerSubobjectParser(subobjectType, parser);
        }
 
        @Override
-       public AutoCloseable registerEROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
+       public final AutoCloseable registerEROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
                        final EROSubobjectSerializer serializer) {
                return this.eroSubReg.registerSubobjectSerializer(subobjectClass, serializer);
        }
 
        @Override
-       public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
+       public final AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
                return this.msgReg.registerMessageParser(messageType, parser);
        }
 
        @Override
-       public AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
+       public final AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
                return this.msgReg.registerMessageSerializer(msgClass, serializer);
        }
 
        @Override
-       public AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
+       public final AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
                return this.objReg.registerObjectParser(objectClass, objectType, parser);
        }
 
        @Override
-       public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
+       public final AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
                return this.objReg.registerObjectSerializer(objClass, serializer);
        }
 
        @Override
-       public AutoCloseable registerRROSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
+       public final AutoCloseable registerRROSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
                return this.rroSubReg.registerSubobjectParser(subobjectType, parser);
        }
 
        @Override
-       public AutoCloseable registerRROSubobjectSerializer(
+       public final AutoCloseable registerRROSubobjectSerializer(
                        final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.record.route.subobjects.SubobjectType> subobjectClass,
                        final RROSubobjectSerializer serializer) {
                return this.rroSubReg.registerSubobjectSerializer(subobjectClass, serializer);
@@ -179,17 +144,17 @@ public final class PCEPExtensionProviderContextImpl implements PCEPExtensionProv
        }
 
        @Override
-       public AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass, final TlvSerializer serializer) {
+       public final AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass, final TlvSerializer serializer) {
                return this.tlvReg.registerTlvSerializer(tlvClass, serializer);
        }
 
        @Override
-       public AutoCloseable registerXROSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
+       public final AutoCloseable registerXROSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
                return this.xroSubReg.registerSubobjectParser(subobjectType, parser);
        }
 
        @Override
-       public AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
+       public final AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
                        final XROSubobjectSerializer serializer) {
                return this.xroSubReg.registerSubobjectSerializer(subobjectClass, serializer);
        }
index 2855f4f288873df9883241b41655c2773794ecde..1eb287931e3301ba2ce75bf9edbae794561e9161 100644 (file)
@@ -9,18 +9,19 @@ package org.opendaylight.protocol.pcep.testtool;
 
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
 import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
 import org.opendaylight.protocol.pcep.impl.PCEPSessionProposalFactoryImpl;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-
 public class Main {
 
        private static final Logger logger = LoggerFactory.getLogger(Main.class);
@@ -126,9 +127,9 @@ public class Main {
 
                final Open prefs = spf.getSessionProposal(address, 0);
 
-               final PCEPDispatcherImpl dispatcher = new PCEPDispatcherImpl(PCEPExtensionProviderContextImpl
+               final PCEPDispatcherImpl dispatcher = new PCEPDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext
                                .getSingletonInstance().getMessageHandlerRegistry(), new DefaultPCEPSessionNegotiatorFactory(
-                               new HashedWheelTimer(), prefs, 5), new NioEventLoopGroup(), new NioEventLoopGroup());
+                                               new HashedWheelTimer(), prefs, 5), new NioEventLoopGroup(), new NioEventLoopGroup());
 
                dispatcher.createServer(address, new TestingSessionListenerFactory()).get();
        }
index dc846b37516b08727b19cea5eeb7e3421b9c5852..5c76d86f3f072d58dafd77f4133190af8986c3a2 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.testtool;
 
-import com.google.common.base.Preconditions;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.HashedWheelTimer;
@@ -15,6 +14,9 @@ import io.netty.util.concurrent.DefaultPromise;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
+
+import java.net.InetSocketAddress;
+
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
 import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
@@ -27,13 +29,13 @@ import org.opendaylight.protocol.pcep.PCEPSessionListener;
 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
 import org.opendaylight.protocol.pcep.impl.PCEPHandlerFactory;
 import org.opendaylight.protocol.pcep.impl.PCEPSessionImpl;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 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.open.object.OpenBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
 
-import java.net.InetSocketAddress;
+import com.google.common.base.Preconditions;
 
 public class PCCMock<M, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> extends AbstractDispatcher<S, L> {
 
@@ -66,15 +68,15 @@ public class PCCMock<M, S extends ProtocolSession<M>, L extends SessionListener<
                final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> snf = new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), new OpenBuilder().setKeepalive(
                                (short) 30).setDeadTimer((short) 120).setSessionId((short) 0).setTlvs(builder.build()).build(), 0);
 
-               final PCCMock<Message, PCEPSessionImpl, PCEPSessionListener> pcc = new PCCMock<>(snf, new PCEPHandlerFactory(PCEPExtensionProviderContextImpl.getSingletonInstance().getMessageHandlerRegistry()), new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE));
+               final PCCMock<Message, PCEPSessionImpl, PCEPSessionListener> pcc = new PCCMock<>(snf, new PCEPHandlerFactory(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry()), new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE));
 
                pcc.createClient(new InetSocketAddress("127.0.0.3", 12345), new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 2000),
                                new SessionListenerFactory<PCEPSessionListener>() {
 
-                                       @Override
-                                       public PCEPSessionListener getSessionListener() {
-                                               return new SimpleSessionListener();
-                                       }
-                               }).get();
+                       @Override
+                       public PCEPSessionListener getSessionListener() {
+                               return new SimpleSessionListener();
+                       }
+               }).get();
        }
 }
diff --git a/pcep/topology-provider-config/.project b/pcep/topology-provider-config/.project
new file mode 100644 (file)
index 0000000..e561b4b
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>pcep-topology-provider-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/pcep/topology-provider-config/pom.xml b/pcep/topology-provider-config/pom.xml
new file mode 100644 (file)
index 0000000..d09905f
--- /dev/null
@@ -0,0 +1,121 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>pcep-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>pcep-topology-provider-config</artifactId>
+   <description>PCE Protocol topology provider configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-topology-provider</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>programming-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>sal-binding-config</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.yangtools.model</groupId>
+         <artifactId>ietf-inet-types</artifactId>
+         <version>${ietf.types.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.pcep.topology.provider
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PCEP-TOPOLOGY-PROVIDER-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
diff --git a/pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModule.java b/pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModule.java
new file mode 100644 (file)
index 0000000..53919b0
--- /dev/null
@@ -0,0 +1,72 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-pcep-topology-provider  yang module local name: pcep-topology-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Mon Nov 18 21:08:29 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.topology.provider;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.bgpcep.pcep.topology.provider.PCEPTopologyProvider;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
+
+/**
+ *
+ */
+public final class PCEPTopologyProviderModule extends org.opendaylight.controller.config.yang.pcep.topology.provider.AbstractPCEPTopologyProviderModule
+{
+       private static final Logger LOG = LoggerFactory.getLogger(PCEPTopologyProviderModule.class);
+
+       public PCEPTopologyProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public PCEPTopologyProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final PCEPTopologyProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       private InetAddress listenAddress() {
+               final IpAddress a = getListenAddress();
+               if (a.getIpv4Address() != null) {
+                       return InetAddresses.forString(a.getIpv4Address().getValue());
+               } else if (a.getIpv6Address() != null) {
+                       return InetAddresses.forString(a.getIpv6Address().getValue());
+               } else {
+                       throw new IllegalArgumentException("Address " + a + " not supported ");
+               }
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final InstanceIdentifier<Topology> topology =
+                               InstanceIdentifier.builder().node(NetworkTopology.class).child(Topology.class, new TopologyKey(getTopologyId())).toInstance();
+               final InetSocketAddress address = new InetSocketAddress(listenAddress(), getListenPort().getValue());
+               try {
+                       return PCEPTopologyProvider.create(getDispatcherDependency(), address,
+                                       getSchedulerDependency(), getDataProviderDependency(), topology);
+               } catch (InterruptedException | ExecutionException e) {
+                       LOG.error("Failed to instantiate topology provider at {}", address, e);
+                       throw new RuntimeException("Failed to instantiate provider", e);
+               }
+       }
+}
diff --git a/pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModuleFactory.java b/pcep/topology-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..f7e213e
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-pcep-topology-provider  yang module local name: pcep-topology-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 21:08:29 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.pcep.topology.provider;
+
+/**
+*
+*/
+public class PCEPTopologyProviderModuleFactory extends org.opendaylight.controller.config.yang.pcep.topology.provider.AbstractPCEPTopologyProviderModuleFactory
+{
+
+
+}
diff --git a/pcep/topology-provider-config/src/main/yang/config-pcep-topology-provider.yang b/pcep/topology-provider-config/src/main/yang/config-pcep-topology-provider.yang
new file mode 100644 (file)
index 0000000..7ce1a22
--- /dev/null
@@ -0,0 +1,100 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-pcep-topology-provider {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:topology:provider";
+    prefix "p2p";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import config-programming-spi { prefix pgmspi; revision-date 2013-11-15; }
+    import config-topology-api { prefix topo; revision-date 2013-11-15; }
+    import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import pcep { prefix pcep; revision-date 2013-04-09; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+        PCEP topology provider service.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity pcep-topology {
+        description
+            "Service representing a PCEP-enabled topology.";
+
+        //base "topo:topology-reference";
+        base "config:service-type";
+        config:java-class "org.opendaylight.bgpcep.topology.TopologyReference";
+    }
+
+    identity pcep-topology-impl {
+        base config:module-type;
+        config:provided-service pcep-topology;
+        config:java-name-prefix PCEPTopologyProvider;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case pcep-topology-impl {
+            when "/config:modules/config:module/config:type = 'pcep-topology-impl'";
+
+            container data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+
+            container dispatcher {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity pcep:pcep-dispatcher;
+                    }
+                }
+            }
+
+            container scheduler {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity pgmspi:instruction-scheduler;
+                    }
+                }
+            }
+
+            leaf topology-id {
+                type nt:topology-id;
+                mandatory true;
+            }
+
+            leaf listen-address {
+                type inet:ip-address;
+//                default "0.0.0.0";
+                mandatory true;
+            }
+
+            leaf listen-port {
+                type inet:port-number;
+//                default 4189;
+                mandatory true;
+            }
+        }
+    }
+}
+
index 94fcf797073a1f812bb74cc22c86d8ae6be36b24..c0efedd1b9207a103495b8bc4378e51c7a6f9c51 100644 (file)
@@ -92,7 +92,6 @@
                        <Private-Package>
                            org.opendaylight.bgpcep.pcep.topology.provider
                        </Private-Package>
-                       <Bundle-Activator>org.opendaylight.bgpcep.pcep.topology.provider.BundleActivator</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
diff --git a/pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/BundleActivator.java b/pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/BundleActivator.java
deleted file mode 100644 (file)
index 9e38ec9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.pcep.topology.provider;
-
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.HashedWheelTimer;
-
-import java.net.InetSocketAddress;
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.protocol.pcep.PCEPDispatcher;
-import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
-import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
-import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
-import org.opendaylight.protocol.pcep.impl.PCEPSessionProposalFactoryImpl;
-import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-public final class BundleActivator extends AbstractBindingAwareProvider {
-       private static final Logger LOG = LoggerFactory.getLogger(BundleActivator.class);
-
-       @Override
-       public void onSessionInitiated(final ProviderContext session) {
-               final DataProviderService dps = Preconditions.checkNotNull(session.getSALService(DataProviderService.class));
-
-               // FIXME: integration with config subsystem should allow this to be injected as a service
-               final InetSocketAddress address = new InetSocketAddress("0.0.0.0", 4189);
-               final PCEPSessionProposalFactory spf = new PCEPSessionProposalFactoryImpl(30, 10, true, true, true, true, 0);
-               final Open prefs = spf.getSessionProposal(address, 0);
-               final PCEPDispatcher dispatcher = new PCEPDispatcherImpl(PCEPExtensionProviderContextImpl
-                               .getSingletonInstance().getMessageHandlerRegistry(), new DefaultPCEPSessionNegotiatorFactory(
-                                               new HashedWheelTimer(), prefs, 5), new NioEventLoopGroup(), new NioEventLoopGroup());
-
-               final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder().node(Topology.class).toInstance();
-
-               final PCEPTopologyProvider exp = new PCEPTopologyProvider(dispatcher, null, dps, topology);
-               final ChannelFuture s = exp.startServer(address);
-               try {
-                       s.get();
-               } catch (InterruptedException | ExecutionException e) {
-                       LOG.error("Failed to instantiate server", e);
-               }
-       }
-}
index e11c564377a370993bb053b0c9e00a0851530be7..ce5035a40209c85da407f43bab150a30d0ab8df3 100644 (file)
@@ -7,11 +7,14 @@
  */
 package org.opendaylight.bgpcep.pcep.topology.provider;
 
+import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 
 import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.protocol.pcep.PCEPDispatcher;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
@@ -19,25 +22,38 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 import com.google.common.base.Preconditions;
 
-public final class PCEPTopologyProvider {
-       private final PCEPDispatcher dispatcher;
-       private final TopologyProgramming topology;
+public final class PCEPTopologyProvider extends DefaultTopologyReference implements AutoCloseable {
        private final ServerSessionManager manager;
+       private final TopologyProgramming network;
        private final TopologyRPCs element;
+       private final Channel channel;
+
+       private PCEPTopologyProvider(final Channel channel, final InstanceIdentifier<Topology> topology, final ServerSessionManager manager,
+                       final TopologyRPCs element, final TopologyProgramming network) {
+               super(topology);
+               this.channel = Preconditions.checkNotNull(channel);
+               this.manager = Preconditions.checkNotNull(manager);
+               this.element = Preconditions.checkNotNull(element);
+               this.network = Preconditions.checkNotNull(network);
+       }
 
-       public PCEPTopologyProvider(final PCEPDispatcher dispatcher,
+       public static PCEPTopologyProvider create(final PCEPDispatcher dispatcher,
+                       final InetSocketAddress address,
                        final InstructionScheduler scheduler,
                        final DataProviderService dataService,
-                       final InstanceIdentifier<Topology> topology) {
-               this.dispatcher = Preconditions.checkNotNull(dispatcher);
-
-
-               this.manager = new ServerSessionManager(dataService, topology);
-               this.element = new TopologyRPCs(manager);
-               this.topology = new TopologyProgramming(scheduler, manager);
+                       final InstanceIdentifier<Topology> topology) throws InterruptedException, ExecutionException {
+
+               final ServerSessionManager manager = new ServerSessionManager(dataService, topology);
+               final TopologyRPCs element = new TopologyRPCs(manager);
+               final TopologyProgramming network = new TopologyProgramming(scheduler, manager);
+               ChannelFuture f = dispatcher.createServer(address, manager);
+               f.get();
+               return new PCEPTopologyProvider(f.channel(), topology, manager, element, network);
        }
 
-       public ChannelFuture startServer(final InetSocketAddress address) {
-               return dispatcher.createServer(address, manager);
+       @Override
+       public void close() throws Exception {
+               channel.close();
+               // FIXME: close other stuff
        }
 }
diff --git a/pcep/tunnel-provider-config/.project b/pcep/tunnel-provider-config/.project
new file mode 100644 (file)
index 0000000..546452e
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>pcep-tunnel-provider-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/pcep/tunnel-provider-config/pom.xml b/pcep/tunnel-provider-config/pom.xml
new file mode 100644 (file)
index 0000000..3c91aff
--- /dev/null
@@ -0,0 +1,121 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>pcep-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>pcep-tunnel-provider-config</artifactId>
+   <description>PCE Protocol tunnel topology provider configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-tunnel-provider</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>programming-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-topology-provider-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>sal-binding-config</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.pcep.topology.provider
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PCEP-TUNNEL-PROVIDER-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
diff --git a/pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModule.java b/pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModule.java
new file mode 100644 (file)
index 0000000..207350d
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-pcep-tunnel-provider  yang module local name: pcep-tunnel-topology-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Tue Nov 19 04:23:38 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.tunnel.provider;
+
+import org.opendaylight.bgpcep.pcep.tunnel.provider.PCEPTunnelTopologyProvider;
+import org.opendaylight.bgpcep.pcep.tunnel.provider.TunnelProgramming;
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.NetworkTopologyPcepService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.TopologyTunnelPcepProgrammingService;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ *
+ */
+public final class PCEPTunnelTopologyProviderModule extends org.opendaylight.controller.config.yang.pcep.tunnel.provider.AbstractPCEPTunnelTopologyProviderModule
+{
+
+       public PCEPTunnelTopologyProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public PCEPTunnelTopologyProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final PCEPTunnelTopologyProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final PCEPTunnelTopologyProvider ttp = PCEPTunnelTopologyProvider.create(getDataProviderDependency(), getSourceTopologyDependency().getInstanceIdentifier(), getTopologyId());
+               final NetworkTopologyPcepService ntps = getRpcRegistryDependency().getRpcService(NetworkTopologyPcepService.class);
+               final TunnelProgramming tp = new TunnelProgramming(getSchedulerDependency(), getDataProviderDependency(), ntps);
+               final RpcRegistration<TopologyTunnelPcepProgrammingService> reg =
+                               getRpcRegistryDependency().addRpcImplementation(TopologyTunnelPcepProgrammingService.class, tp);
+
+               final class TunnelTopologyReferenceCloseable extends DefaultTopologyReference implements AutoCloseable {
+                       public TunnelTopologyReferenceCloseable(final InstanceIdentifier<Topology> instanceIdentifier) {
+                               super(instanceIdentifier);
+                       }
+
+                       @Override
+                       public void close() throws Exception {
+                               try {
+                                       reg.close();
+                               } finally {
+                                       try {
+                                               tp.close();
+                                       } finally {
+                                               ttp.close();
+                                       }
+                               }
+                       }
+               }
+
+               return new TunnelTopologyReferenceCloseable(ttp.getTopologyReference().getInstanceIdentifier());
+       }
+}
diff --git a/pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleFactory.java b/pcep/tunnel-provider-config/src/main/java/org/opendaylight/controller/config/yang/pcep/tunnel/provider/PCEPTunnelTopologyProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..faa283f
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-pcep-tunnel-provider  yang module local name: pcep-tunnel-topology-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Nov 19 04:23:38 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.pcep.tunnel.provider;
+
+/**
+*
+*/
+public class PCEPTunnelTopologyProviderModuleFactory extends org.opendaylight.controller.config.yang.pcep.tunnel.provider.AbstractPCEPTunnelTopologyProviderModuleFactory
+{
+
+
+}
diff --git a/pcep/tunnel-provider-config/src/main/yang/config-pcep-tunnel-provider.yang b/pcep/tunnel-provider-config/src/main/yang/config-pcep-tunnel-provider.yang
new file mode 100644 (file)
index 0000000..d85b364
--- /dev/null
@@ -0,0 +1,96 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-pcep-tunnel-provider {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:tunnel:provider";
+    prefix "tun";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import config-programming-spi { prefix pgmspi; revision-date 2013-11-15; }
+    import config-pcep-topology-provider { prefix pceptopo; revision-date 2013-11-15; }
+    import config-topology-api { prefix topo; revision-date 2013-11-15; }
+    import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+        PCEP tunnel topology provider service.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity pcep-tunnel-topology {
+        description
+            "Service representing a PCEP-enabled tunnel topology.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.bgpcep.topology.TopologyReference";
+    }
+
+    identity pcep-tunnel-topology-impl {
+        base config:module-type;
+        config:provided-service pcep-tunnel-topology;
+        config:java-name-prefix PCEPTunnelTopologyProvider;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case pcep-tunnel-topology-impl {
+            when "/config:modules/config:module/config:type = 'pcep-tunnel-topology-impl'";
+
+            container data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }
+
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+
+            container scheduler {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity pgmspi:instruction-scheduler;
+                    }
+                }
+            }
+
+            container source-topology {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity pceptopo:pcep-topology;
+                    }
+                }
+            }
+
+            leaf topology-id {
+                type nt:topology-id;
+                mandatory true;
+            }
+        }
+    }
+}
+
index 8e2dcf219e612151502f1ae12981515c00db548b..9a8366d76bc6643084a61443f8c66e94a5b27571 100644 (file)
@@ -80,7 +80,6 @@
                        <Private-Package>
                            org.opendaylight.bgpcep.pcep.tunnel.provider
                        </Private-Package>
-                       <Bundle-Activator>org.opendaylight.bgpcep.pcep.tunnel.provider.BundleActivator</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
diff --git a/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/BundleActivator.java b/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/BundleActivator.java
deleted file mode 100644 (file)
index 8bea183..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opendaylight.bgpcep.pcep.tunnel.provider;
-
-import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.NetworkTopologyPcepService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-public final class BundleActivator extends AbstractBindingAwareProvider {
-       private static final Logger LOG = LoggerFactory.getLogger(BundleActivator.class);
-
-       @Override
-       public void onSessionInitiated(final ProviderContext session) {
-               final DataProviderService dps = Preconditions.checkNotNull(session.getSALService(DataProviderService.class));
-
-               // FIXME: migrate to config subsystem
-               final TunnelTopologyExporter tte = new TunnelTopologyExporter(dps, null);
-               tte.addTargetTopology(null);
-
-               final InstructionScheduler scheduler = null;
-               final TunnelProgramming tp = new TunnelProgramming(scheduler, dps, session.getRpcService(NetworkTopologyPcepService.class));
-       }
-}
diff --git a/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/PCEPTunnelTopologyProvider.java b/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/PCEPTunnelTopologyProvider.java
new file mode 100644 (file)
index 0000000..fd04a95
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.bgpcep.pcep.tunnel.provider;
+
+import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
+import org.opendaylight.bgpcep.topology.TopologyReference;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Preconditions;
+
+public final class PCEPTunnelTopologyProvider implements AutoCloseable {
+       private final ListenerRegistration<DataChangeListener> reg;
+       private final TopologyReference ref;
+
+       private PCEPTunnelTopologyProvider(final InstanceIdentifier<Topology> dst, final ListenerRegistration<DataChangeListener> reg) {
+               this.ref = new DefaultTopologyReference(dst);
+               this.reg = Preconditions.checkNotNull(reg);
+       }
+
+       public static PCEPTunnelTopologyProvider create(final DataProviderService dataProvider,
+                       final InstanceIdentifier<Topology> sourceTopology, final TopologyId targetTopology) {
+               final InstanceIdentifier<Topology> dst =
+                               InstanceIdentifier.builder().node(NetworkTopology.class).
+                               child(Topology.class, new TopologyKey(targetTopology)).toInstance();
+               final NodeChangedListener ncl = new NodeChangedListener(dataProvider, dst);
+
+               final InstanceIdentifier<Node> src = InstanceIdentifier.builder(sourceTopology).child(Node.class).toInstance();
+               final ListenerRegistration<DataChangeListener> reg = dataProvider.registerDataChangeListener(src, ncl);
+
+               return new PCEPTunnelTopologyProvider(dst, reg);
+       }
+
+       @Override
+       public void close() throws Exception {
+               reg.close();
+       }
+
+       public TopologyReference getTopologyReference() {
+               return ref;
+       }
+}
index 78a8dcc2d74ea77dcc75f7aa1a3761f215f07adf..37e5fb332c5789e90b62dce4404f5cab8bb77273 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.bgpcep.pcep.tunnel.provider;
 
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -82,13 +81,13 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 
-final class TunnelProgramming implements TopologyTunnelPcepProgrammingService {
+public final class TunnelProgramming implements TopologyTunnelPcepProgrammingService, AutoCloseable {
        private static final Logger LOG = LoggerFactory.getLogger(TunnelProgramming.class);
        private final NetworkTopologyPcepService topologyService;
        private final DataProviderService dataProvider;
        private final InstructionScheduler scheduler;
 
-       TunnelProgramming(final InstructionScheduler scheduler, final DataProviderService dataProvider,
+       public TunnelProgramming(final InstructionScheduler scheduler, final DataProviderService dataProvider,
                        final NetworkTopologyPcepService topologyService) {
                this.scheduler = Preconditions.checkNotNull(scheduler);
                this.dataProvider = Preconditions.checkNotNull(dataProvider);
@@ -278,12 +277,12 @@ final class TunnelProgramming implements TopologyTunnelPcepProgrammingService {
        // FIXME: tunnel programming utility class
        private InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final BaseTunnelInput input) {
                return InstanceIdentifier.builder(topology).
-                               node(Link.class, new LinkKey(Preconditions.checkNotNull(input.getLinkId()))).toInstance();
+                               child(Link.class, new LinkKey(Preconditions.checkNotNull(input.getLinkId()))).toInstance();
        }
 
        private Node sourceNode(final DataModificationTransaction t, final InstanceIdentifier<Topology> topology, final Link link) {
                final InstanceIdentifier<Node> nii = InstanceIdentifier.builder(topology).
-                               node(Node.class, new NodeKey(link.getSource().getSourceNode())).toInstance();
+                               child(Node.class, new NodeKey(link.getSource().getSourceNode())).toInstance();
                return (Node) t.readOperationalData(nii);
        }
 
@@ -383,4 +382,9 @@ final class TunnelProgramming implements TopologyTunnelPcepProgrammingService {
                final RpcResult<PcepUpdateTunnelOutput> res = SuccessfulRpcResult.create(b.build());
                return Futures.immediateFuture(res);
        }
+
+       @Override
+       public void close() {
+               // FIXME: remove all scheduled instructions, etc.
+       }
 }
diff --git a/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelTopologyExporter.java b/pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelTopologyExporter.java
deleted file mode 100644 (file)
index ea71b93..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.pcep.tunnel.provider;
-
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import com.google.common.base.Preconditions;
-
-final class TunnelTopologyExporter {
-       private final DataProviderService dataProvider;
-       private final InstanceIdentifier<Node> srcTree;
-
-       TunnelTopologyExporter(final DataProviderService dataProvider, final InstanceIdentifier<Topology> sourceTopology) {
-               this.dataProvider = Preconditions.checkNotNull(dataProvider);
-               srcTree = Preconditions.checkNotNull(InstanceIdentifier.builder(sourceTopology).child(Node.class).toInstance());
-       }
-
-       ListenerRegistration<?> addTargetTopology(final InstanceIdentifier<Topology> tunnelTopology) {
-               return dataProvider.registerDataChangeListener(srcTree, new NodeChangedListener(dataProvider, tunnelTopology));
-       }
-}
diff --git a/programming/impl-config/.project b/programming/impl-config/.project
new file mode 100644 (file)
index 0000000..2692d41
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>programming-impl-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/programming/impl-config/pom.xml b/programming/impl-config/pom.xml
new file mode 100644 (file)
index 0000000..9e5642f
--- /dev/null
@@ -0,0 +1,103 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>programming-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>programming-impl-config</artifactId>
+   <description>Programming implementation CONFIG</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>programming-spi-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>programming-impl</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>sal-binding-config</artifactId>
+        <version>1.0-SNAPSHOT</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.programming.impl
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PROGRAMMING-IMPL-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModule.java b/programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModule.java
new file mode 100644 (file)
index 0000000..bd3902a
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: config-programming-impl  yang module local name: instruction-scheduler-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Mon Nov 18 16:50:17 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.programming.impl;
+
+import io.netty.util.HashedWheelTimer;
+import io.netty.util.Timer;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.opendaylight.bgpcep.programming.impl.ProgrammingServiceImpl;
+import org.opendaylight.bgpcep.programming.spi.InstructionExecutor;
+import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.ProgrammingService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.SubmitInstructionInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.submit.instruction.output.result.failure.Failure;
+
+/**
+ *
+ */
+public final class InstructionSchedulerImplModule extends org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerImplModule
+{
+
+       public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(identifier, dependencyResolver);
+       }
+
+       public InstructionSchedulerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final InstructionSchedulerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
+               super(identifier, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate(){
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               // FIXME: configured timer
+               final Timer timer = new HashedWheelTimer();
+
+               final ExecutorService exec = Executors.newSingleThreadExecutor();
+
+               final ProgrammingServiceImpl inst = new ProgrammingServiceImpl(getNotificationServiceDependency(), exec, timer);
+
+               final RpcRegistration<ProgrammingService> reg = getRpcRegistryDependency().addRpcImplementation(ProgrammingService.class, inst);
+
+               final class ProgrammingServiceImplCloseable implements InstructionScheduler, AutoCloseable {
+                       @Override
+                       public void close() throws Exception {
+                               try {
+                                       reg.close();
+                               } finally {
+                                       try {
+                                               inst.close();
+                                       } finally {
+                                               exec.shutdown();
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public Failure submitInstruction(final SubmitInstructionInput input, final InstructionExecutor executor) {
+                               return inst.submitInstruction(input, executor);
+                       }
+               }
+
+               return new ProgrammingServiceImplCloseable();
+       }
+}
diff --git a/programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModuleFactory.java b/programming/impl-config/src/main/java/org/opendaylight/controller/config/yang/programming/impl/InstructionSchedulerImplModuleFactory.java
new file mode 100644 (file)
index 0000000..9761f26
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: config-programming-impl  yang module local name: instruction-scheduler-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Nov 18 16:50:17 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.programming.impl;
+
+/**
+*
+*/
+public class InstructionSchedulerImplModuleFactory extends org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerImplModuleFactory
+{
+
+
+}
diff --git a/programming/impl-config/src/main/yang/config-programming-impl.yang b/programming/impl-config/src/main/yang/config-programming-impl.yang
new file mode 100644 (file)
index 0000000..b3e7e21
--- /dev/null
@@ -0,0 +1,61 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-programming-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:programming:impl";
+    prefix "pgm";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+    import config-programming-spi { prefix spi; revision-date 2013-11-15; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         Programming implementation.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity instruction-scheduler-impl {
+        base config:module-type;
+        config:provided-service spi:instruction-scheduler;
+        config:java-name-prefix InstructionSchedulerImpl;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case instruction-scheduler-impl {
+            when "/config:modules/config:module/config:type = 'instruction-scheduler-impl'";
+
+            container notification-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-notification-service;
+                    }
+                }
+            }
+
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+        }
+    }
+}
+
index 3d2af93597a50475e05106e891e0ff4c1ab528dd..de5a59cddcab732b1908bb3044faa7deca749ea1 100644 (file)
@@ -76,7 +76,6 @@
                        <Private-Package>
                            org.opendaylight.bgpcep.programming.impl,
                        </Private-Package>
-                       <Bundle-Activator>org.opendaylight.bgpcep.programming.impl.BundleActivator</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
diff --git a/programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/BundleActivator.java b/programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/BundleActivator.java
deleted file mode 100644 (file)
index 255ee12..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.bgpcep.programming.impl;
-
-import io.netty.util.HashedWheelTimer;
-import io.netty.util.Timer;
-
-import java.util.concurrent.Executors;
-
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.ProgrammingService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-public final class BundleActivator extends AbstractBindingAwareProvider {
-       private static final Logger LOG = LoggerFactory.getLogger(BundleActivator.class);
-       private RpcRegistration<ProgrammingService> reg;
-       private final Timer timer = new HashedWheelTimer();
-
-       @Override
-       public void onSessionInitiated(final ProviderContext session) {
-               final NotificationProviderService notifs = Preconditions.checkNotNull(session.getSALService(NotificationProviderService.class));
-
-               reg = Preconditions.checkNotNull(session.addRpcImplementation(ProgrammingService.class,
-                               new ProgrammingServiceImpl(notifs, Executors.newSingleThreadExecutor(), timer)));
-       }
-}
index 4ca61a11148eef5159bb8837f0c5ada74e736290..b20eda0fdee4808280575c09367c41dcbe0dff57 100644 (file)
@@ -59,9 +59,12 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 
-final class ProgrammingServiceImpl implements InstructionScheduler, ProgrammingService {
+public final class ProgrammingServiceImpl implements InstructionScheduler, ProgrammingService, AutoCloseable {
        private static final Logger LOG = LoggerFactory.getLogger(ProgrammingServiceImpl.class);
 
+       // Default stop timeout, in seconds
+       private static final long CLOSE_TIMEOUT = 5;
+
        private final Map<InstructionId, Instruction> insns = new HashMap<>();
 
        @GuardedBy("this")
@@ -73,7 +76,7 @@ final class ProgrammingServiceImpl implements InstructionScheduler, ProgrammingS
        private java.util.concurrent.Future<Void> thread;
        private ExecutorService exec;
 
-       ProgrammingServiceImpl(final NotificationProviderService notifs, final ExecutorService executor,
+       public ProgrammingServiceImpl(final NotificationProviderService notifs, final ExecutorService executor,
                        final Timer timer) {
                this.notifs = Preconditions.checkNotNull(notifs);
                this.executor = Preconditions.checkNotNull(executor);
@@ -420,4 +423,9 @@ final class ProgrammingServiceImpl implements InstructionScheduler, ProgrammingS
                exec.awaitTermination(timeout, unit);
                exec = null;
        }
+
+       @Override
+       public void close() throws Exception {
+               stop(CLOSE_TIMEOUT, TimeUnit.SECONDS);
+       }
 }
index e3a4b3822336ecc8dea434f1750766a1cbb5154e..87ce70a29d09c6714606a0715a0bf4cc89ee8e6a 100644 (file)
@@ -19,7 +19,9 @@
        <modules>
         <module>api</module>
         <module>impl</module>
+        <module>impl-config</module>
         <module>spi</module>
+        <module>spi-config</module>
         <module>topology-api</module>
                <module>tunnel-api</module>
     </modules>
diff --git a/programming/spi-config/.project b/programming/spi-config/.project
new file mode 100644 (file)
index 0000000..91b759a
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>programming-spi-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/programming/spi-config/pom.xml b/programming/spi-config/pom.xml
new file mode 100644 (file)
index 0000000..f5f29af
--- /dev/null
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>programming-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>programming-spi-config</artifactId>
+   <description>Programming SPI CONFIG</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>programming-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.programming.spi
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PROGRAMMING-SPI-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
diff --git a/programming/spi-config/src/main/yang/config-programming-spi.yang b/programming/spi-config/src/main/yang/config-programming-spi.yang
new file mode 100644 (file)
index 0000000..4fb3b25
--- /dev/null
@@ -0,0 +1,37 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-programming-spi {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:programming:spi";
+    prefix "spi";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         Programming SPI.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity instruction-scheduler {
+        description
+            "Service representing an instruction scheduler.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.bgpcep.programming.spi.InstructionScheduler";
+    }
+}
+
diff --git a/topology/api-config/.project b/topology/api-config/.project
new file mode 100644 (file)
index 0000000..84ae265
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>topology-api-config</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/topology/api-config/pom.xml b/topology/api-config/pom.xml
new file mode 100644 (file)
index 0000000..31bf130
--- /dev/null
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>topology-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>topology-api-config</artifactId>
+   <description>Topology API configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>topology-api</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-maven-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <executions>
+               <execution>
+                  <goals>
+                     <goal>generate-sources</goal>
+                  </goals>
+                  <configuration>
+                     <codeGenerators>
+                        <generator>
+                           <codeGeneratorClass>
+                              org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                           </codeGeneratorClass>
+                           <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                           <additionalConfiguration>
+                              <namespaceToPackage1>
+                                 urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                              </namespaceToPackage1>
+                           </additionalConfiguration>
+                        </generator>
+                     </codeGenerators>
+                     <inspectDependencies>true</inspectDependencies>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.opendaylight.controller</groupId>
+                  <artifactId>yang-jmx-generator-plugin</artifactId>
+                  <version>${controller.config.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <version>${maven.bundle.version}</version>
+            <extensions>true</extensions>
+            <configuration>
+               <instructions>
+                  <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                  <Export-Package>
+                     org.opendaylight.controller.config.yang.pcep
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>TOPOLOGY-API-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
diff --git a/topology/api-config/src/main/yang/config-topology-api.yang b/topology/api-config/src/main/yang/config-topology-api.yang
new file mode 100644 (file)
index 0000000..994f784
--- /dev/null
@@ -0,0 +1,37 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module config-topology-api {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:topology";
+    prefix "topo";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+        Topology API.
+
+        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
+
+        This program and the accompanying materials are made available
+        under the terms of the Eclipse Public License v1.0 which
+        accompanies this distribution, and is available at
+        http://www.eclipse.org/legal/epl-v10.html";
+
+    revision "2013-11-15" {
+        description
+            "Initial revision";
+    }
+
+    identity topology-reference {
+        description
+            "Service representing a reference to a topology instance.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.bgpcep.topology.TopologyReference";
+    }
+}
+
index a05c153298409df118c3a378cc1e9e4f5dc5d10d..99fdd1723172955dcd89a56245d723bc85b84c54 100644 (file)
        </prerequisites>
 
        <dependencies>
+               <dependency>
+                       <groupId>${project.groupId}</groupId>
+                       <artifactId>concepts</artifactId>
+            <version>${project.version}</version>
+               </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-binding</artifactId>
                    <instructions>
                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
                        <Export-Package>
-                           org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ospf.topology.rev130712.*,
-                           org.opendaylight.yang.gen.v1.urn.TBD.params.xml.ns.yang.network.ted.rev130712.*,
-                           org.opendaylight.yang.gen.v1.urn.TBD.params.xml.ns.yang.network.topology.rev130712.*,
-                           org.opendaylight.yang.gen.v1.urn.TBD.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev130712.*,
-                           org.opendaylight.yang.gen.v1.urn.TBD.params.xml.ns.yang.network.isis.topology.rev130712.*,
+                           org.opendaylight.bgpcep.topology,
+                           org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.*,
+                           org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.*,
+                           org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.*,
+                           org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.*,
+                           org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.*,
                        </Export-Package>
                    </instructions>
                </configuration>
diff --git a/topology/api/src/main/java/org/opendaylight/bgpcep/topology/DefaultTopologyReference.java b/topology/api/src/main/java/org/opendaylight/bgpcep/topology/DefaultTopologyReference.java
new file mode 100644 (file)
index 0000000..5b49cd7
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.bgpcep.topology;
+
+import org.opendaylight.protocol.concepts.DefaultInstanceReference;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ *
+ */
+public class DefaultTopologyReference extends DefaultInstanceReference<Topology> implements TopologyReference {
+       public DefaultTopologyReference(final InstanceIdentifier<Topology> instanceIdentifier) {
+               super(instanceIdentifier);
+       }
+}
diff --git a/topology/api/src/main/java/org/opendaylight/bgpcep/topology/TopologyReference.java b/topology/api/src/main/java/org/opendaylight/bgpcep/topology/TopologyReference.java
new file mode 100644 (file)
index 0000000..de362bb
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.bgpcep.topology;
+
+import org.opendaylight.protocol.concepts.InstanceReference;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+
+/**
+ * A reference to an Topology instance
+ */
+public interface TopologyReference extends InstanceReference<Topology> {
+
+}
index a924fa7f6ac40b4b6a34c1afa316d6437c047ad7..ced74f0053d38c95363d1e97ac4defac37f7cf92 100644 (file)
@@ -18,6 +18,7 @@
        
        <modules>
         <module>api</module>
+        <module>api-config</module>
                <module>tunnel-api</module>
         <module>segment-routing</module>
     </modules>