--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+ * 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();
+ }
+ }
+ };
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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;
+ }
+ }
+ }
+ }
+ }
+}
+
+++ /dev/null
-/*
- * 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();
- }
-}
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() {
}
@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;
+ }
}
}
}
<Export-Package>
org.opendaylight.protocol.bgp.parser.impl.*
</Export-Package>
- <Activator>org.opendaylight.protocol.bgp.parser.impl.BundleActivator</Activator>
</instructions>
</configuration>
</plugin>
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
+++ /dev/null
-/*
- * 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();
- }
-}
-org.opendaylight.protocol.bgp.parser.impl.Activator
+org.opendaylight.protocol.bgp.parser.impl.BGPActivator
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+* 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");
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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'";
+ }
+ }
+}
+
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
<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>
<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>
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);
}
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;
}
}
@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);
}
}
--- /dev/null
+/**
+ * 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();
+ }
+ };
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+/**
+ * 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();
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
"value is not set.", ribNameJmxAttribute);
JmxAttributeValidationException.checkCondition(!getRibName().isEmpty(),
"should not be empty string.", ribNameJmxAttribute);
+ JmxAttributeValidationException.checkNotNull(getExtensions(),
+ "is not set.", extensionsJmxAttribute);
}
@Override
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());
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; }
"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.";
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'";
}
}
base config:module-type;
config:provided-service bgp-proposal;
config:java-name-prefix BGPSessionProposalImpl;
-
}
augment "/config:modules/config:module/config:configuration" {
base config:module-type;
config:provided-service bgp-dispatcher;
config:java-name-prefix BGPDispatcherImpl;
-
}
augment "/config:modules/config:module/config:configuration" {
}
}
- 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" {
}
}
+ container extensions {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity ribspi:consumer-extensions;
+ }
+ }
+ }
+
leaf rib-name {
mandatory true;
type string;
}
}
}
-
-
}
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>
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;
+ }
+ }
}
}
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);
@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));
}
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+// 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";
+ }
+}
+
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();
}
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+ * 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());
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+/**
+ * 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());
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+/**
+ * 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());
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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;
+ }
+ }
+ }
+}
+
<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>
* 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;
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;
/**
*
*/
-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) {
}
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,
removeEmptyNode(trans, nii);
}
+
}
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;
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);
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) {
@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?
+ }
}
* 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
* 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
* 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;
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;
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) {
}
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();
}
}
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)));
}
+++ /dev/null
-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);
- }
-}
+++ /dev/null
-/*
- * 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);
- }
-}
+++ /dev/null
-/*
- * 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);
- }
-}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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();
+}
<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>
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);
}
JmxAttributeValidationException.checkCondition(
getMaxUnknownMessages() > 0, "Parameter 'maxUnknownMessages' "
+ "must be greater than 0",
- this.maxUnknownMessagesJmxAttribute);
+ this.maxUnknownMessagesJmxAttribute);
}
@Override
timer, localPrefs, getMaxUnknownMessages());
final PCEPDispatcherImpl instance = new PCEPDispatcherImpl(
- PCEPExtensionProviderContextImpl.getSingletonInstance()
- .getMessageHandlerRegistry(), negFactory,
- getBossGroupDependency(), getWorkerGroupDependency());
+ getExtensionsDependency().getMessageHandlerRegistry(),
+ negFactory, getBossGroupDependency(), getWorkerGroupDependency());
return instance;
}
}
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.";
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 {
}
}
}
-
-
}
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 {
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
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) {
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) {
.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(
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(
"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;
}
<Private-Package>
org.opendaylight.protocol.pcep.impl.*,
</Private-Package>
- <Activator>org.opendaylight.protocol.pcep.parser.impl.BundleActivator</Activator>
</instructions>
</configuration>
</plugin>
+++ /dev/null
-/*
- * 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();
- }
-}
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;
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 };
@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(
@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();
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;
@Before
public void setUp() throws Exception {
- this.tlvRegistry = PCEPExtensionProviderContextImpl.create().getTlvHandlerRegistry();
+ this.tlvRegistry = ServiceLoaderPCEPExtensionProviderContext.create().getTlvHandlerRegistry();
}
@Test
@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();
@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 };
@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 };
@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();
@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();
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;
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
@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());
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;
@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);
<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>
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+* 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();
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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'";
+ }
+ }
+}
+
--- /dev/null
+/*
+ * 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;
+ }
+}
*/
package org.opendaylight.protocol.pcep.spi.pojo;
-import java.util.ServiceLoader;
-
import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.protocol.pcep.spi.EROSubobjectHandlerRegistry;
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;
*
*/
@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();
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);
}
@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);
}
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);
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();
}
*/
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;
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;
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> {
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();
}
}
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+ * 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);
+ }
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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;
+ }
+ }
+ }
+}
+
<Private-Package>
org.opendaylight.bgpcep.pcep.topology.provider
</Private-Package>
- <Bundle-Activator>org.opendaylight.bgpcep.pcep.topology.provider.BundleActivator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
+++ /dev/null
-/*
- * 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);
- }
- }
-}
*/
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;
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
}
}
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+ * 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());
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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;
+ }
+ }
+ }
+}
+
<Private-Package>
org.opendaylight.bgpcep.pcep.tunnel.provider
</Private-Package>
- <Bundle-Activator>org.opendaylight.bgpcep.pcep.tunnel.provider.BundleActivator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
+++ /dev/null
-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));
- }
-}
--- /dev/null
+/*
+ * 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;
+ }
+}
*/
package org.opendaylight.bgpcep.pcep.tunnel.provider;
-
import java.util.ArrayList;
import java.util.List;
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);
// 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);
}
final RpcResult<PcepUpdateTunnelOutput> res = SuccessfulRpcResult.create(b.build());
return Futures.immediateFuture(res);
}
+
+ @Override
+ public void close() {
+ // FIXME: remove all scheduled instructions, etc.
+ }
}
+++ /dev/null
-/*
- * 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));
- }
-}
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+/**
+ * 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();
+ }
+}
--- /dev/null
+/**
+* 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
+{
+
+
+}
--- /dev/null
+// 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;
+ }
+ }
+ }
+ }
+ }
+}
+
<Private-Package>
org.opendaylight.bgpcep.programming.impl,
</Private-Package>
- <Bundle-Activator>org.opendaylight.bgpcep.programming.impl.BundleActivator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
+++ /dev/null
-/*
- * 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)));
- }
-}
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")
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);
exec.awaitTermination(timeout, unit);
exec = null;
}
+
+ @Override
+ public void close() throws Exception {
+ stop(CLOSE_TIMEOUT, TimeUnit.SECONDS);
+ }
}
<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>
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+// 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";
+ }
+}
+
--- /dev/null
+<?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>
--- /dev/null
+<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>
--- /dev/null
+// 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";
+ }
+}
+
</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>
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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> {
+
+}
<modules>
<module>api</module>
+ <module>api-config</module>
<module>tunnel-api</module>
<module>segment-routing</module>
</modules>