Merge "BUG-108: rename routes objects to prevent confusion"
authorDana Kutenicsova <dkutenic@cisco.com>
Mon, 11 Nov 2013 12:19:42 +0000 (12:19 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 11 Nov 2013 12:19:42 +0000 (12:19 +0000)
37 files changed:
bgp/pom.xml
bgp/rib-api-config/pom.xml [new file with mode: 0644]
bgp/rib-api-config/src/main/yang/bgp-rib.yang [new file with mode: 0644]
bgp/rib-impl-config/pom.xml [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java [new file with mode: 0644]
bgp/rib-impl-config/src/main/yang/bgp-rib-impl.yang [new file with mode: 0644]
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java
bgp/update-api-config/pom.xml [new file with mode: 0644]
bgp/update-api-config/src/main/yang/bgp-listener.yang [new file with mode: 0644]
bgp/update-mock-config/pom.xml [new file with mode: 0644]
bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModule.java [new file with mode: 0644]
bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModuleFactory.java [new file with mode: 0644]
bgp/update-mock-config/src/main/yang/bgp-mock.yang [new file with mode: 0644]
pcep/api-config/pom.xml [new file with mode: 0644]
pcep/api-config/src/main/yang/pcep.yang [new file with mode: 0644]
pcep/api/src/main/yang/pcep-types.yang
pcep/impl-config/pom.xml [new file with mode: 0644]
pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModule.java [new file with mode: 0644]
pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleFactory.java [new file with mode: 0644]
pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java [new file with mode: 0644]
pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java [new file with mode: 0644]
pcep/impl-config/src/main/yang/pcep-impl.yang [new file with mode: 0644]
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/AbstractPCEPSessionNegotiator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/message/PCCreateMessageParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/FiniteStateMachineTest.java
pcep/pom.xml
pom.xml

index 41073eea18b805ee60e64127052c6c8028157b07..99a6075f47658ae9ff5dff20825c64e75a0c854a 100644 (file)
@@ -30,5 +30,9 @@
         <module>rib-mock</module>
         <module>topology-provider</module>
         <module>util</module>
-    </modules>
+        <module>rib-api-config</module>
+        <module>update-api-config</module>
+        <module>update-mock-config</module>
+        <module>rib-impl-config</module>
+       </modules>
 </project>
diff --git a/bgp/rib-api-config/pom.xml b/bgp/rib-api-config/pom.xml
new file mode 100644 (file)
index 0000000..f5b2367
--- /dev/null
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>bgp-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>bgp-rib-api-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-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.bgp.rib
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-RIB-API-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
\ No newline at end of file
diff --git a/bgp/rib-api-config/src/main/yang/bgp-rib.yang b/bgp/rib-api-config/src/main/yang/bgp-rib.yang
new file mode 100644 (file)
index 0000000..7a20fe1
--- /dev/null
@@ -0,0 +1,38 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module bgp-rib {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib";
+    prefix "bgprib";
+
+    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-07-01" {
+        description
+            "Initial revision";
+    }
+
+    identity rib {
+        description
+            "Service representing a BGP RIB service. Each instance allows
+             registration of listeners.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Rib";
+    }
+}
+
diff --git a/bgp/rib-impl-config/pom.xml b/bgp/rib-impl-config/pom.xml
new file mode 100644 (file)
index 0000000..b7fe703
--- /dev/null
@@ -0,0 +1,122 @@
+<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-impl-config</artifactId>
+   <description>BGP RIB implementation configuration</description>
+   <packaging>bundle</packaging>
+   <name>${project.artifactId}</name>
+   <prerequisites>
+      <maven>3.0.4</maven>
+   </prerequisites>
+
+   <dependencies>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-api-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-rib-impl</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-parser-impl</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-update-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+       <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>sal-binding-config</artifactId>
+         <version>1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>threadpool-config-api</artifactId>
+         <version>${controller.config.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.impl
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-RIB-IMPL-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModule.java
new file mode 100644 (file)
index 0000000..05680c2
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-dispatcher-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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.BGPMessageFactory;
+import org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl;
+
+/**
+*
+*/
+public final class BGPDispatcherImplModule
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPDispatcherImplModule {
+
+       public BGPDispatcherImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public BGPDispatcherImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       BGPDispatcherImplModule oldModule,
+                       java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final BGPMessageFactory messageFactoryDependency = getMessageFactoryDependency();
+               return new BGPDispatcherImpl(messageFactoryDependency, getBossGroupDependency(), getWorkerGroupDependency());
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPDispatcherImplModuleFactory.java
new file mode 100644 (file)
index 0000000..70c7412
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-dispatcher-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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 BGPDispatcherImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPDispatcherImplModuleFactory {
+
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModule.java
new file mode 100644 (file)
index 0000000..d15bc50
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:31 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 java.net.InetSocketAddress;
+
+import org.opendaylight.protocol.bgp.rib.impl.BGPImpl;
+
+/**
+*
+*/
+public final class BGPImplModule
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPImplModule {
+
+       public BGPImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public BGPImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       BGPImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               InetSocketAddress address = new InetSocketAddress(getHost(), getPort());
+               return new BGPImpl(getBgpDispatcherDependency(), address,
+                               getBgpProposalDependency());
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPImplModuleFactory.java
new file mode 100644 (file)
index 0000000..7e8e29b
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:31 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 BGPImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPImplModuleFactory {
+
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModule.java
new file mode 100644 (file)
index 0000000..235ba23
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-message-factory-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:31 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.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 {
+
+       public BGPMessageFactoryImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       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) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               try {
+                       return new BGPMessageFactoryCloseable(new BGPMessageFactoryImpl(
+                                       ServiceLoaderBGPExtensionProviderContext
+                                                       .createConsumerContext().getMessageRegistry()));
+               } catch (Exception e) {
+                       throw new RuntimeException("Failed to create consumer context.", e);
+               }
+       }
+
+       private static class BGPMessageFactoryCloseable implements
+                       BGPMessageFactory, AutoCloseable {
+               private final BGPMessageFactoryImpl inner;
+
+               public BGPMessageFactoryCloseable(
+                               BGPMessageFactoryImpl bgpMessageFactory) {
+                       this.inner = bgpMessageFactory;
+               }
+
+               @Override
+               public void close() throws Exception {
+                       // NOOP
+               }
+
+               @Override
+               public Notification parse(byte[] bytes) throws DeserializerException,
+                               DocumentedException {
+                       return inner.parse(bytes);
+               }
+
+               @Override
+               public byte[] put(Notification bgpMessage) {
+                       return inner.put(bgpMessage);
+               }
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPMessageFactoryImplModuleFactory.java
new file mode 100644 (file)
index 0000000..bbe69ae
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-message-factory-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:31 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 BGPMessageFactoryImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPMessageFactoryImplModuleFactory {
+
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModule.java
new file mode 100644 (file)
index 0000000..3d9b817
--- /dev/null
@@ -0,0 +1,72 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-proposal-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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.BGPSessionProposalImpl;
+import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
+import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionProposal;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+
+/**
+*
+*/
+public final class BGPSessionProposalImplModule
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPSessionProposalImplModule {
+
+       public BGPSessionProposalImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public BGPSessionProposalImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       BGPSessionProposalImplModule oldModule,
+                       java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               final Ipv4Address bgpId = new Ipv4Address(getBgpId());
+               final BGPSessionProposalImpl bgpSessionProposal = new BGPSessionProposalImpl(
+                               getHoldtimer(), getAsNumber(), bgpId);
+               return new BgpSessionProposalCloseable(bgpSessionProposal);
+       }
+
+       private static final class BgpSessionProposalCloseable implements
+                       BGPSessionProposal, AutoCloseable {
+
+               private final BGPSessionProposalImpl inner;
+
+               public BgpSessionProposalCloseable(
+                               BGPSessionProposalImpl bgpSessionProposal) {
+                       this.inner = bgpSessionProposal;
+               }
+
+               @Override
+               public void close() throws Exception {
+                       // NOOP
+               }
+
+               @Override
+               public BGPSessionPreferences getProposal() {
+                       return inner.getProposal();
+               }
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPSessionProposalImplModuleFactory.java
new file mode 100644 (file)
index 0000000..a43c638
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-proposal-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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 BGPSessionProposalImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPSessionProposalImplModuleFactory {
+
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java
new file mode 100644 (file)
index 0000000..5ee3dbb
--- /dev/null
@@ -0,0 +1,112 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: rib-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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 io.netty.util.concurrent.GlobalEventExecutor;
+
+import java.io.IOException;
+
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
+import org.opendaylight.protocol.bgp.rib.impl.BGP;
+import org.opendaylight.protocol.bgp.rib.impl.BGPPeer;
+import org.opendaylight.protocol.bgp.rib.impl.RIBImpl;
+import org.opendaylight.protocol.concepts.ListenerRegistration;
+import org.opendaylight.protocol.framework.TimedReconnectStrategy;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.base.Preconditions;
+
+/**
+*
+*/
+public final class RIBImplModule
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModule {
+
+       public RIBImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public RIBImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       RIBImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               // Add custom validation for module attributes here.
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               BAProvider provider = new BAProvider();
+
+               ProviderContext providerContext = ((BindingAwareBroker) getOsgiRegistry())
+                               .registerProvider(provider, provider.ctx);
+               DataProviderService dataProviderService = providerContext
+                               .getSALService(DataProviderService.class);
+               RIBImpl rib = new RIBImpl(dataProviderService);
+               BGP bgp = getBgpDependency();
+               final BGPPeer peer = new BGPPeer(rib, "peer-" + bgp.toString());
+
+               try {
+                       final long reconnects = getReconnectAttempts();
+                       ListenerRegistration<BGPSessionListener> reg = bgp
+                                       .registerUpdateListener(peer, new TimedReconnectStrategy(
+                                                       GlobalEventExecutor.INSTANCE,
+                                                       getConnectionTimeout(), 5000, 1.0, null,
+                                                       reconnects, null));
+                       return new RibImplCloseable(reg, rib);
+               } catch (IOException e) {
+                       throw new RuntimeException("Failed to register with BGP", e);
+               }
+       }
+
+       private static final class RibImplCloseable implements AutoCloseable {
+               private final ListenerRegistration<BGPSessionListener> reg;
+               private final RIBImpl innerRib;
+
+               private RibImplCloseable(ListenerRegistration<BGPSessionListener> reg,
+                               RIBImpl innerRib) {
+                       this.reg = reg;
+                       this.innerRib = innerRib;
+               }
+
+               @Override
+               public void close() throws Exception {
+                       reg.close();
+               }
+       }
+
+       private static final class BAProvider extends AbstractBindingAwareProvider {
+
+               BundleContext ctx;
+
+               @Override
+               public void onSessionInitiated(ProviderContext session) {
+
+               }
+
+               @Override
+               protected void startImpl(final BundleContext context) {
+                       this.ctx = Preconditions.checkNotNull(context);
+               }
+
+       }
+}
diff --git a/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java b/bgp/rib-impl-config/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleFactory.java
new file mode 100644 (file)
index 0000000..58bb01e
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-rib-impl  yang module local name: rib-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:02:32 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 RIBImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModuleFactory {
+
+}
diff --git a/bgp/rib-impl-config/src/main/yang/bgp-rib-impl.yang b/bgp/rib-impl-config/src/main/yang/bgp-rib-impl.yang
new file mode 100644 (file)
index 0000000..b1510f0
--- /dev/null
@@ -0,0 +1,227 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module bgp-rib-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl";
+    prefix "bgprib-impl";
+
+    import bgp-listener { prefix bgpl; revision-date 2013-04-09; }
+    import bgp-rib { prefix bgprib; revision-date 2013-07-01; }
+    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; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP listener 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-04-09" {
+        description
+            "Initial revision";
+    }
+
+    identity bgp-message-factory {
+        description
+            "Service representing a BGP proposal.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.parser.BGPMessageFactory";
+    }
+
+    identity bgp-message-factory-impl {
+        base config:module-type;
+        config:provided-service bgp-message-factory;
+        config:java-name-prefix BGPMessageFactoryImpl;
+
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-message-factory-impl {
+            when "/config:modules/config:module/config:type = 'bgp-message-factory-impl'";
+        }
+    }
+
+    identity bgp-proposal {
+        description
+            "Service representing a BGP proposal.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionProposal";
+    }
+
+    identity bgp-proposal-impl {
+        base config:module-type;
+        config:provided-service bgp-proposal;
+        config:java-name-prefix BGPSessionProposalImpl;
+
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-proposal-impl {
+            when "/config:modules/config:module/config:type = 'bgp-proposal-impl'";
+
+            leaf holdtimer {
+                type int16;
+                default 180;
+            }
+
+            leaf bgp-id {
+                mandatory true;
+                type string;
+            }
+
+            leaf as-number {
+                mandatory true;
+                type int32;
+            }
+        }
+    }
+
+    identity bgp-dispatcher {
+        description
+            "Service representing a BGP Dispatcher.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher";
+    }
+
+    identity bgp-dispatcher-impl {
+        base config:module-type;
+        config:provided-service bgp-dispatcher;
+        config:java-name-prefix BGPDispatcherImpl;
+
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-dispatcher-impl {
+            when "/config:modules/config:module/config:type = 'bgp-dispatcher-impl'";
+
+            container message-factory {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgp-message-factory;
+                    }
+                }
+            }
+            
+            container boss-group {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity th:netty-threadgroup;
+                    }
+                }
+            }
+            
+            container worker-group {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity th:netty-threadgroup;
+                    }
+                }
+            }
+        }
+    }
+
+    identity bgp-impl {
+        base config:module-type;
+            config:provided-service bgpl:listener;
+        config:java-name-prefix BGPImpl;
+
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bgp-impl {
+            when "/config:modules/config:module/config:type = 'bgp-impl'";
+
+            container bgp-dispatcher {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgp-dispatcher;
+                    }
+                }
+            }
+
+            container bgp-proposal {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgp-proposal;
+                    }
+                }
+            }
+
+            leaf host {
+                 mandatory true;
+                 type string;
+            }
+
+            leaf port {
+                 mandatory true;
+                 type uint16;
+            }
+        }
+    }
+
+     identity rib-impl {
+        base config:module-type;
+        config:provided-service bgprib:rib;
+        config:java-name-prefix RIBImpl;
+     }
+
+
+    augment "/config:modules/config:module/config:configuration" {
+        case rib-impl {
+            when "/config:modules/config:module/config:type = 'rib-impl'";
+
+            container bgp {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity bgpl:listener;
+                    }
+                }
+            }
+
+            leaf rib-name {
+                 mandatory true;
+                 type string;
+            }
+
+            leaf connection-timeout {
+                 mandatory true;
+                 type int32;
+            }
+
+            leaf reconnect-attempts {
+                 mandatory true;
+                 type int64;
+            }
+                       
+            container osgi-registry {
+               uses config:service-ref {
+                       refine type {
+                               mandatory true;
+                               config:required-identity mdsb:binding-broker-osgi-registry;
+                       }
+               }
+            }
+        }
+    }
+
+
+}
+
index b3e754d9ad1458de73b40d67998fcf96389d33fe..1c5ea526ca19c11fc678de2af8f5cccb0f921017 100644 (file)
@@ -31,12 +31,12 @@ import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
 
 @ThreadSafe
-final class RIBImpl {
+public class RIBImpl {
        private static final Logger logger = LoggerFactory.getLogger(RIBImpl.class);
        private final DataProviderService dps;
        private final RIBTables tables;
 
-       RIBImpl(final DataProviderService dps) {
+       public RIBImpl(final DataProviderService dps) {
                this.dps = Preconditions.checkNotNull(dps);
                this.tables = new RIBTables(BGPObjectComparator.INSTANCE, AdjRIBsInFactoryRegistryImpl.INSTANCE);
        }
diff --git a/bgp/update-api-config/pom.xml b/bgp/update-api-config/pom.xml
new file mode 100644 (file)
index 0000000..0bfb8c2
--- /dev/null
@@ -0,0 +1,92 @@
+<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-update-api-config</artifactId>
+   <description>BGP Update API</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-impl</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.listener
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-UPDATE-API-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+
+</project>
\ No newline at end of file
diff --git a/bgp/update-api-config/src/main/yang/bgp-listener.yang b/bgp/update-api-config/src/main/yang/bgp-listener.yang
new file mode 100644 (file)
index 0000000..aee09f9
--- /dev/null
@@ -0,0 +1,39 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module bgp-listener {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:listener";
+    prefix "bgpl";
+
+    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-04-09" {
+        description
+            "Initial revision";
+    }
+
+    identity listener {
+        description
+            "Service representing a BGP service. Each instance allows
+             registration of listeners. Each listener has its own BGP session.
+             Events happening on the session are routed to the listener.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.bgp.rib.impl.BGP";
+    }
+}
+
diff --git a/bgp/update-mock-config/pom.xml b/bgp/update-mock-config/pom.xml
new file mode 100644 (file)
index 0000000..1a76a75
--- /dev/null
@@ -0,0 +1,101 @@
+<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-update-mock-config</artifactId>
+   <description>BGP UPDATE MOCK 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-update-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>threadpool-config-api</artifactId>
+         <version>${controller.config.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>bgp-rib-mock</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.mock
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>BGP-UPDATE-MOCK-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModule.java b/bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModule.java
new file mode 100644 (file)
index 0000000..23f622d
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-mock  yang module local name: bgp-mock
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 12:46:58 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.mock;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.Nullable;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
+import org.opendaylight.protocol.bgp.rib.mock.BGPMock;
+import org.opendaylight.protocol.bgp.util.BinaryBGPDumpFileParser;
+import org.opendaylight.protocol.bgp.util.HexDumpBGPFileParser;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+
+/**
+*
+*/
+public final class BgpMockModule extends
+               org.opendaylight.controller.config.yang.bgp.mock.AbstractBgpMockModule {
+
+       private List<byte[]> bgpMessages;
+
+       public BgpMockModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public BgpMockModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       BgpMockModule oldModule, java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               JmxAttributeValidationException.checkCondition(
+                               (getBinDump() != null && getHexDump() != null) == false,
+                               "Both 'HexDump' and 'BinDump' contain value",
+                               binDumpJmxAttribute);
+               if (getBinDump() == null && getHexDump() == null) {
+                       bgpMessages = new ArrayList<>();
+               } else if (getHexDump() != null) {
+                       try {
+                               bgpMessages = HexDumpBGPFileParser.parseMessages(getHexDump());
+                               bgpMessages = Lists.newArrayList(fixMessages(bgpMessages));
+                       } catch (Exception e) {
+                               JmxAttributeValidationException.wrap(e,
+                                               "Error while parsing HexDump", hexDumpJmxAttribute);
+                       }
+               } else {
+                       try {
+                               bgpMessages = BinaryBGPDumpFileParser
+                                               .parseMessages(getBinDump());
+                       } catch (Exception e) {
+                               JmxAttributeValidationException.wrap(e,
+                                               "Error while parsing BinDump", binDumpJmxAttribute);
+                       }
+               }
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               try {
+                       return new BGPMock(getEventBusDependency(),
+                                       ServiceLoaderBGPExtensionProviderContext
+                                                       .createConsumerContext().getMessageRegistry(),
+                                       bgpMessages);
+               } catch (Exception e) {
+                       throw new RuntimeException("Failed to create consumer context.", e);
+               }
+       }
+
+       private Collection<byte[]> fixMessages(Collection<byte[]> bgpMessages) {
+               return Collections2.transform(bgpMessages,
+                               new Function<byte[], byte[]>() {
+
+                                       @Nullable
+                                       @Override
+                                       public byte[] apply(@Nullable byte[] input) {
+                                               byte[] ret = new byte[input.length + 1];
+                                               // ff
+                                               ret[0] = -1;
+                                               for (int i = 0; i < input.length; i++) {
+                                                       ret[i + 1] = input[i];
+                                               }
+                                               return ret;
+                                       }
+                               });
+       }
+}
diff --git a/bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModuleFactory.java b/bgp/update-mock-config/src/main/java/org/opendaylight/controller/config/yang/bgp/mock/BgpMockModuleFactory.java
new file mode 100644 (file)
index 0000000..2828e27
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: bgp-mock  yang module local name: bgp-mock
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 12:46:58 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.bgp.mock;
+
+/**
+*
+*/
+public class BgpMockModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.bgp.mock.AbstractBgpMockModuleFactory {
+
+}
diff --git a/bgp/update-mock-config/src/main/yang/bgp-mock.yang b/bgp/update-mock-config/src/main/yang/bgp-mock.yang
new file mode 100644 (file)
index 0000000..b7b491f
--- /dev/null
@@ -0,0 +1,59 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module bgp-mock {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:mock";
+    prefix "th-java";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import threadpool { prefix th; revision-date 2013-04-09; }
+    import bgp-listener { prefix bgpl; revision-date 2013-04-09; }
+
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         BGP message parser pure Java 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-04-09" {
+        description
+            "Initial version.";
+    }
+
+    identity bgp-mock {
+        base config:module-type;
+        config:provided-service bgpl:listener;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case bgp-mock {
+                       when "/config:modules/config:module/config:type = 'bgp-mock'";
+                       container eventBus {
+                               uses config:service-ref {
+                                       refine type {
+                                               mandatory true;
+                                               config:required-identity th:eventbus;
+                                       }
+                               }
+                       }
+
+                       leaf hexDump {
+                               type string;
+                       }
+
+                       leaf binDump {
+                               type binary;
+                       }
+        }
+    }
+}
+
diff --git a/pcep/api-config/pom.xml b/pcep/api-config/pom.xml
new file mode 100644 (file)
index 0000000..3d9c04b
--- /dev/null
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <parent>
+      <groupId>org.opendaylight.bgpcep</groupId>
+      <artifactId>pcep-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>pcep-api-config</artifactId>
+   <description>PCE Protocol API</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-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>PCEP-API-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/pcep/api-config/src/main/yang/pcep.yang b/pcep/api-config/src/main/yang/pcep.yang
new file mode 100644 (file)
index 0000000..67cf117
--- /dev/null
@@ -0,0 +1,48 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module pcep {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep";
+    prefix "pcep";
+
+    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 protocol handler.
+
+        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-04-09" {
+        description
+            "Initial revision";
+    }
+
+    identity pcep-dispatcher {
+        description
+            "Service representing a PCEP dispatcher service. The service
+             can create both PCEP client sessions and PCEP servers.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.pcep.PCEPDispatcher";
+    }
+
+    identity pcep-session-proposal-factory {
+        description
+            "Service representing a PCEP session proposal factory service. The service
+             provides initial session attributes given by the user.";
+
+        base "config:service-type";
+        config:java-class "org.opendaylight.protocol.pcep.PCEPSessionProposalFactory";
+    }
+
+}
+
index 43112e3da349ae5d77683c7dc0bbe9291f4a6650..8774adfd276638190573673b2ff6bbd78e10ca1b 100644 (file)
@@ -1003,7 +1003,7 @@ module pcep-types {
 
                uses include-route-object;
 
-               uses of-object;
+               //uses of-object;
 
                uses classtype-object;
        }
diff --git a/pcep/impl-config/pom.xml b/pcep/impl-config/pom.xml
new file mode 100644 (file)
index 0000000..c7c0c63
--- /dev/null
@@ -0,0 +1,100 @@
+<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-impl-config</artifactId>
+   <description>PCE Protocol Implementation</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-impl</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>${project.groupId}</groupId>
+         <artifactId>pcep-api-config</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.opendaylight.controller</groupId>
+         <artifactId>threadpool-config-api</artifactId>
+         <version>${controller.config.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>
+                  </Export-Package>
+               </instructions>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <distributionManagement>
+      <site>
+         <id>${project.artifactId}</id>
+         <name>PCEP-IMPL-CONFIG Module site</name>
+         <url>${basedir}/target/site/${project.artifactId}</url>
+      </site>
+   </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModule.java b/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModule.java
new file mode 100644 (file)
index 0000000..51f0db2
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: pcep-impl  yang module local name: pcep-dispatcher-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:16:39 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.impl;
+
+import io.netty.util.HashedWheelTimer;
+import io.netty.util.Timer;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
+import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
+import org.opendaylight.protocol.pcep.spi.pojo.PCEPExtensionProviderContextImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
+
+/**
+*
+*/
+public final class PCEPDispatcherImplModule
+               extends
+               org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModule {
+
+       public PCEPDispatcherImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       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) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               JmxAttributeValidationException.checkCondition(
+                               getMaxUnknownMessages() > 0, "Parameter 'maxUnknownMessages' "
+                                               + "must be greater than 0",
+                               this.maxUnknownMessagesJmxAttribute);
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               Timer timer = new HashedWheelTimer();
+               Open localPrefs = getPcepSessionProposalFactoryDependency()
+                               .getSessionProposal(null, -1);
+               DefaultPCEPSessionNegotiatorFactory negFactory = new DefaultPCEPSessionNegotiatorFactory(
+                               timer, localPrefs, getMaxUnknownMessages());
+
+               final PCEPDispatcherImpl instance = new PCEPDispatcherImpl(
+                               PCEPExtensionProviderContextImpl.getSingletonInstance()
+                                               .getMessageHandlerRegistry(), negFactory, getBossGroupDependency(), getWorkerGroupDependency());
+               return instance;
+       }
+}
diff --git a/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleFactory.java b/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPDispatcherImplModuleFactory.java
new file mode 100644 (file)
index 0000000..2d067e1
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: pcep-impl  yang module local name: pcep-dispatcher-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:16:39 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.impl;
+
+/**
+*
+*/
+public class PCEPDispatcherImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModuleFactory {
+
+}
diff --git a/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java b/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModule.java
new file mode 100644 (file)
index 0000000..fc3cc23
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:16:39 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.impl;
+
+import java.net.InetSocketAddress;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
+import org.opendaylight.protocol.pcep.impl.PCEPSessionProposalFactoryImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
+
+/**
+*
+*/
+public final class PCEPSessionProposalFactoryImplModule
+               extends
+               org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModule {
+
+       public PCEPSessionProposalFactoryImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+               super(name, dependencyResolver);
+       }
+
+       public PCEPSessionProposalFactoryImplModule(
+                       org.opendaylight.controller.config.api.ModuleIdentifier name,
+                       org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                       PCEPSessionProposalFactoryImplModule oldModule,
+                       java.lang.AutoCloseable oldInstance) {
+               super(name, dependencyResolver, oldModule, oldInstance);
+       }
+
+       @Override
+       public void validate() {
+               super.validate();
+               JmxAttributeValidationException
+                               .checkCondition(
+                                               getDeadTimerValue() % getKeepAliveTimerValue() != 4,
+                                               "Parameter 'dead timer value' should be 4 times greater than keepAlive timer value.",
+                                               deadTimerValueJmxAttribute);
+               if ((getActive() || getVersioned() || getTimeout() > 0)
+                               && !getStateful())
+                       setStateful(true);
+       }
+
+       @Override
+       public java.lang.AutoCloseable createInstance() {
+               PCEPSessionProposalFactoryImpl inner = new PCEPSessionProposalFactoryImpl(
+                               getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(),
+                               getActive(), getVersioned(), getInstantiated(), getTimeout());
+               return new PCEPSessionProposalFactoryCloseable(inner);
+       }
+
+       private static final class PCEPSessionProposalFactoryCloseable implements
+                       PCEPSessionProposalFactory, AutoCloseable {
+
+               private PCEPSessionProposalFactoryImpl inner;
+
+               public PCEPSessionProposalFactoryCloseable(
+                               PCEPSessionProposalFactoryImpl inner) {
+                       this.inner = inner;
+               }
+
+               @Override
+               public void close() throws Exception {
+               }
+
+               @Override
+               public Open getSessionProposal(
+                               InetSocketAddress inetSocketAddress, int i) {
+                       return inner.getSessionProposal(inetSocketAddress, i);
+               }
+       }
+}
diff --git a/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java b/pcep/impl-config/src/main/java/org/opendaylight/controller/config/yang/pcep/impl/PCEPSessionProposalFactoryImplModuleFactory.java
new file mode 100644 (file)
index 0000000..11c181a
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Generated file
+
+ * Generated from: yang module name: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
+ * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+ * Generated at: Wed Nov 06 13:16:39 CET 2013
+ *
+ * Do not modify this file unless it is present under src/main directory
+ */
+package org.opendaylight.controller.config.yang.pcep.impl;
+
+/**
+*
+*/
+public class PCEPSessionProposalFactoryImplModuleFactory
+               extends
+               org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModuleFactory {
+
+}
diff --git a/pcep/impl-config/src/main/yang/pcep-impl.yang b/pcep/impl-config/src/main/yang/pcep-impl.yang
new file mode 100644 (file)
index 0000000..ac19e63
--- /dev/null
@@ -0,0 +1,122 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module pcep-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:impl";
+    prefix "pcep-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import pcep { prefix pcep; revision-date 2013-04-09; }
+    import threadpool { prefix th; revision-date 2013-04-09; }
+
+    organization "Cisco Systems, Inc.";
+
+    contact "Robert Varga <rovarga@cisco.com>";
+
+    description
+        "This module contains the base YANG definitions for
+         PCEP 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-06-27" {
+        description
+            "Updated revision dates for imports.";
+    }
+
+    revision "2013-04-09" {
+        description
+            "Initial revision";
+    }
+
+    identity pcep-dispatcher-impl {
+        base config:module-type;
+        config:provided-service pcep:pcep-dispatcher;
+        config:java-name-prefix PCEPDispatcherImpl;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case pcep-dispatcher-impl {
+                       when "/config:modules/config:module/config:type = 'pcep-dispatcher-impl'";
+
+                       leaf max-unknown-messages {
+                               type uint16;
+                       }
+
+                       container pcep-session-proposal-factory {
+                               uses config:service-ref {
+                                       refine type {
+                                               mandatory true;
+                                               config:required-identity pcep:pcep-session-proposal-factory;
+                                       }
+                               }
+                       }
+                       
+                       container boss-group {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity th:netty-threadgroup;
+                    }
+                }
+            }
+            
+            container worker-group {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity th:netty-threadgroup;
+                    }
+                }
+            }
+        }
+    }
+
+       identity pcep-session-proposal-factory-impl {
+        base config:module-type;
+        config:java-name-prefix "PCEPSessionProposalFactoryImpl";
+        config:provided-service pcep:pcep-session-proposal-factory;
+    }
+
+       augment "/config:modules/config:module/config:configuration" {
+               case pcep-session-proposal-factory-impl {
+                       when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-impl'";
+
+
+                       leaf dead-timer-value {
+                               type uint16;
+                       }
+
+                       leaf keep-alive-timer-value {
+                               type uint16;
+                       }
+
+                       leaf instantiated {
+                               type boolean;
+                       }
+
+                       leaf timeout {
+                               type uint16;
+                       }
+
+                       leaf stateful {
+                               type boolean;
+                       }
+
+                       leaf active {
+                               type boolean;
+                       }
+
+                       leaf versioned {
+                               type boolean;
+                       }
+               }
+       }
+
+
+}
+
index 96abf428ffacd88f14264a2d899b119809e3350e..6666388a3b78af9bd533550231a785ebd2277f9b 100644 (file)
@@ -20,10 +20,12 @@ import javax.annotation.concurrent.GuardedBy;
 
 import org.opendaylight.protocol.framework.AbstractSessionNegotiator;
 import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr;
 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.OpenMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcerrMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.message.OpenMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
@@ -31,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 
 /**
@@ -49,7 +52,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
         * action is to terminate negotiation. This timer is restarted between state transitions and runs in all states
         * except Idle and Finished.
         */
-       private enum State {
+       @VisibleForTesting
+       public enum State {
                /**
                 * Negotiation has not begun. It will be activated once we are asked to provide our initial proposal, at which
                 * point we move into OpenWait state.
@@ -87,6 +91,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
 
        private volatile boolean localOK, openRetry, remoteOK;
 
+       private final Keepalive keepalive = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
+
        protected AbstractPCEPSessionNegotiator(final Timer timer, final Promise<PCEPSessionImpl> promise, final Channel channel) {
                super(promise, channel);
                this.timer = Preconditions.checkNotNull(timer);
@@ -103,7 +109,7 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
         * Get the revised session parameters proposal based on the feedback the peer has provided to us.
         * 
         * @param suggestion Peer-provided suggested session parameters
-        * @return Session parameters proposal.
+        * @return Session parameters proposal, or null if peers session parameters preclude us from suggesting anything
         */
        protected abstract Open getRevisedProposal(Open suggestion);
 
@@ -201,7 +207,7 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                case Idle:
                        throw new IllegalStateException("Unexpected handleMessage in state " + this.state);
                case KeepWait:
-                       if (msg instanceof KeepaliveMessage) {
+                       if (msg instanceof Keepalive) {
                                this.localOK = true;
                                if (this.remoteOK) {
                                        negotiationSuccessful(createSession(this.timer, this.channel, this.localPrefs, this.remotePrefs));
@@ -213,8 +219,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                                }
 
                                return;
-                       } else if (msg instanceof PcerrMessage) {
-                               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessage err = ((PcerrMessage) msg).getPcerrMessage();
+                       } else if (msg instanceof Pcerr) {
+                               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessage err = ((Pcerr) msg).getPcerrMessage();
                                this.localPrefs = getRevisedProposal(((Session) err.getErrorType()).getOpen());
                                if (this.localPrefs == null) {
                                        sendErrorMessage(PCEPErrors.PCERR_NON_ACC_SESSION_CHAR);
@@ -222,7 +228,7 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                                        this.state = State.Finished;
                                        return;
                                }
-
+                               this.channel.writeAndFlush(new OpenBuilder().setOpenMessage(new OpenMessageBuilder().setOpen(this.localPrefs).build()).build());
                                if (!this.remoteOK) {
                                        this.state = State.OpenWait;
                                }
@@ -232,11 +238,11 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
 
                        break;
                case OpenWait:
-                       if (msg instanceof OpenMessage) {
-                               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.message.OpenMessage o = ((OpenMessage) msg).getOpenMessage();
+                       if (msg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open) {
+                               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.message.OpenMessage o = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open) msg).getOpenMessage();
                                final Open open = o.getOpen();
                                if (isProposalAcceptable(open)) {
-                                       this.channel.writeAndFlush(new KeepaliveMessageBuilder().build());
+                                       this.channel.writeAndFlush(this.keepalive);
                                        this.remotePrefs = open;
                                        this.remoteOK = true;
                                        if (this.localOK) {
@@ -281,4 +287,8 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                negotiationFailed(new Exception("Illegal message encountered"));
                this.state = State.Finished;
        }
+
+       public synchronized State getState() {
+               return this.state;
+       }
 }
index dfc85b0fdb2a58af5f8139816dd0d455edb18464..d584613d88ecfcc2b47bc9ce0a74cb53f90999b0 100644 (file)
@@ -30,6 +30,8 @@ import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
 import org.opendaylight.protocol.pcep.TerminationReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.CloseMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
@@ -97,7 +99,7 @@ public class PCEPSessionImpl extends AbstractProtocolSession<Message> implements
 
        private final Channel channel;
 
-       private final KeepaliveMessage kaMessage = (KeepaliveMessage) new KeepaliveMessageBuilder().build();
+       private final Keepalive kaMessage = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
 
        PCEPSessionImpl(final Timer timer, final PCEPSessionListener listener, final int maxUnknownMessages, final Channel channel,
                        final Open localOpen, final Open remoteOpen) {
index 31d9c282e42d37b715c987b5d8beb00c56c80389..54a1f86250a7a20a30a3da1e0f7070d27f2e8344 100644 (file)
@@ -9,22 +9,37 @@ package org.opendaylight.protocol.pcep.impl.message;
 
 import io.netty.buffer.ByteBuf;
 
+import java.util.Arrays;
 import java.util.List;
 
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
+import org.opendaylight.protocol.pcep.PCEPErrorMapping;
 import org.opendaylight.protocol.pcep.UnknownObject;
 import org.opendaylight.protocol.pcep.impl.AbstractMessageParser;
 import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.BandwidthObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.EndpointsObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExplicitRouteObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspaObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcinitiate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcinitiateBuilder;
 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.MetricObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcinitiateMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObj;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.Iro;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.object.Lsp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.Lspa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.metric.object.Metric;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.PcinitiateMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.Requests;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.RequestsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.srp.object.Srp;
 
 import com.google.common.collect.Lists;
 
@@ -45,7 +60,31 @@ public class PCCreateMessageParser extends AbstractMessageParser {
                        throw new IllegalArgumentException("Wrong instance of Message. Passed instance of " + message.getClass()
                                        + ". Needed PcinitiateMessage.");
                }
-               // final PcinitiateMessage init =
+               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.PcinitiateMessage init = ((Pcinitiate) message).getPcinitiateMessage();
+               for (final Requests req : init.getRequests()) {
+                       buffer.writeBytes(serializeObject(req.getSrp()));
+                       buffer.writeBytes(serializeObject(req.getLsp()));
+                       if (req.getEndpointsObj() != null) {
+                               buffer.writeBytes(serializeObject(req.getEndpointsObj()));
+                       }
+                       if (req.getEro() != null) {
+                               buffer.writeBytes(serializeObject(req.getEro()));
+                       }
+                       if (req.getLspa() != null) {
+                               buffer.writeBytes(serializeObject(req.getLspa()));
+                       }
+                       if (req.getBandwidth() != null) {
+                               buffer.writeBytes(serializeObject(req.getBandwidth()));
+                       }
+                       if (req.getMetrics() != null && !req.getMetrics().isEmpty()) {
+                               for (final Metrics m : req.getMetrics()) {
+                                       buffer.writeBytes(serializeObject(m.getMetric()));
+                               }
+                       }
+                       if (req.getIro() != null) {
+                               buffer.writeBytes(serializeObject(req.getIro()));
+                       }
+               }
        }
 
        @Override
@@ -61,56 +100,41 @@ public class PCCreateMessageParser extends AbstractMessageParser {
                if (objects == null) {
                        throw new IllegalArgumentException("Passed list can't be null.");
                }
-               return null;
-               // final List<CompositeInstantiationObject> insts = new ArrayList<CompositeInstantiationObject>();
-               //
-               // CompositeInstantiationObject inst;
-               // while (!objects.isEmpty()) {
-               // try {
-               // if ((inst = this.getValidInstantiationObject(objects)) == null) {
-               // break;
-               // }
-               // } catch (final PCEPDocumentedException e) {
-               // return Arrays.asList((Message) new PCEPErrorMessage(new PCEPErrorObject(e.getError())));
-               // }
-               //
-               // insts.add(inst);
-               // }
-               //
-               // if (insts.isEmpty()) {
-               // throw new PCEPDeserializerException("At least one CompositeInstantiationObject is mandatory.");
-               // }
-               //
-               // if (!objects.isEmpty()) {
-               // throw new PCEPDeserializerException("Unprocessed objects: " + objects);
-               // }
-               //
-               // return Arrays.asList((Message) new PCCreateMessage(insts));
-       }
-
-       private void getValidInstantiationObject(final List<Object> objects) throws PCEPDocumentedException {
-               if (objects.get(0) instanceof UnknownObject) {
-                       throw new PCEPDocumentedException("Unknown object", ((UnknownObject) objects.get(0)).getError());
-               }
-               if (!(objects.get(0) instanceof EndpointsObject)) {
-                       return;
+               final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
+               final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
+               final List<Requests> reqs = Lists.newArrayList();
+               Requests req = null;
+               while (!objects.isEmpty()) {
+                       try {
+                               if ((req = this.getValidRequest(objects)) == null) {
+                                       break;
+                               }
+                       } catch (final PCEPDocumentedException e) {
+                               final PcerrMessageBuilder b = new PcerrMessageBuilder();
+                               b.setErrors(Arrays.asList(new ErrorsBuilder().setErrorObject(
+                                               new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e.getError()).type).setValue(
+                                                               maping.getFromErrorsEnum(e.getError()).value).build()).build()));
+                               return new PcerrBuilder().setPcerrMessage(b.build()).build();
+                       }
+                       reqs.add(req);
                }
+               builder.setRequests(reqs);
+               return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build();
+       }
 
-               final EndpointsObject endPoints = ((EndpointsObject) objects.get(0));
+       private Requests getValidRequest(final List<Object> objects) throws PCEPDocumentedException {
+               final Srp srp = ((Srp) objects.get(0));
                objects.remove(0);
 
-               if (objects.get(0) instanceof UnknownObject) {
-                       throw new PCEPDocumentedException("Unknown object", ((UnknownObject) objects.get(0)).getError());
-               }
-               if (!(objects.get(0) instanceof LspaObject)) {
-                       throw new PCEPDocumentedException("LSPA Object must be second.", PCEPErrors.LSPA_MISSING);
-               }
-               final LspaObject lspa = (LspaObject) objects.get(0);
+               final Lsp lsp = (Lsp) objects.get(0);
                objects.remove(0);
 
-               ExplicitRouteObject ero = null;
-               BandwidthObject bandwidth = null;
-               final List<MetricObject> metrics = Lists.newArrayList();
+               EndpointsObj endpoints = null;
+               Ero ero = null;
+               Lspa lspa = null;
+               Bandwidth bandwidth = null;
+               final List<Metrics> metrics = Lists.newArrayList();
+               Iro iro = null;
 
                Object obj;
                int state = 1;
@@ -123,33 +147,49 @@ public class PCCreateMessageParser extends AbstractMessageParser {
                        switch (state) {
                        case 1:
                                state = 2;
-                               if (obj instanceof ExplicitRouteObject) {
-                                       ero = (ExplicitRouteObject) obj;
+                               if (obj instanceof EndpointsObj) {
+                                       endpoints = (EndpointsObj) obj;
                                        break;
                                }
                        case 2:
                                state = 3;
-                               if (obj instanceof BandwidthObject) {
-                                       bandwidth = (BandwidthObject) obj;
+                               if (obj instanceof Ero) {
+                                       ero = (Ero) obj;
                                        break;
                                }
                        case 3:
                                state = 4;
-                               if (obj instanceof MetricObject) {
-                                       metrics.add((MetricObject) obj);
-                                       state = 3;
+                               if (obj instanceof Lspa) {
+                                       lspa = (Lspa) obj;
+                                       break;
+                               }
+                       case 4:
+                               state = 5;
+                               if (obj instanceof Bandwidth) {
+                                       bandwidth = (Bandwidth) obj;
+                                       break;
+                               }
+                       case 5:
+                               state = 6;
+                               if (obj instanceof Metric) {
+                                       metrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
+                                       state = 5;
+                                       break;
+                               }
+                       case 6:
+                               state = 7;
+                               if (obj instanceof Iro) {
+                                       iro = (Iro) obj;
                                        break;
                                }
                        }
-
-                       if (state == 4) {
+                       if (state == 7) {
                                break;
                        }
-
                        objects.remove(0);
                }
-
-               // return new CompositeInstantiationObject(endPoints, lspa, ero, bandwidth, metrics);
+               return new RequestsBuilder().setSrp(srp).setLsp(lsp).setEndpointsObj(endpoints).setEro(ero).setLspa(lspa).setBandwidth(bandwidth).setMetrics(
+                               metrics).setIro(iro).build();
        }
 
        @Override
index 358be3d533b134e082eed4c14eddef34ce2b49a9..09274f83cfc05cab8397b9d3e1d2292f6bca9fcf 100644 (file)
@@ -9,58 +9,106 @@ package org.opendaylight.protocol.pcep.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelPipeline;
+import io.netty.util.HashedWheelTimer;
+import io.netty.util.concurrent.DefaultPromise;
+import io.netty.util.concurrent.GlobalEventExecutor;
+
+import java.util.Arrays;
+import java.util.List;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.opendaylight.protocol.pcep.PCEPErrorMapping;
 import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
-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.message.rev131007.Keepalive;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OpenMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.message.OpenMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.error.type.SessionBuilder;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+import com.google.common.collect.Lists;
 
 public class FiniteStateMachineTest {
 
-       private ServerSessionMock serverSession;
+       private DefaultPCEPSessionNegotiator serverSession;
+
+       @Mock
+       private Channel clientListener;
+
+       @Mock
+       private ChannelPipeline pipeline;
+
+       private final List<Notification> receivedMsgs = Lists.newArrayList();
 
-       private final SimpleSessionListener serverListener = new SimpleSessionListener();
+       private Open openmsg;
 
-       private MockPCE client;
+       private Keepalive kamsg;
 
        @Before
        public void setUp() {
-               this.client = new MockPCE();
-               this.serverSession = new ServerSessionMock(this.serverListener, this.client);
-               this.client.addSession(this.serverSession);
+               MockitoAnnotations.initMocks(this);
+               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open localPrefs = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder().setKeepalive(
+                               (short) 1).build();
+               this.serverSession = new DefaultPCEPSessionNegotiator(new HashedWheelTimer(), new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE), this.clientListener, new SimpleSessionListener(), (short) 1, 20, localPrefs);
+               doAnswer(new Answer<Object>() {
+                       @Override
+                       public Object answer(final InvocationOnMock invocation) {
+                               final Object[] args = invocation.getArguments();
+                               FiniteStateMachineTest.this.receivedMsgs.add((Notification) args[0]);
+                               return null;
+                       }
+               }).when(this.clientListener).writeAndFlush(any(Notification.class));
+               doReturn("TestingChannel").when(this.clientListener).toString();
+               doReturn(this.pipeline).when(this.clientListener).pipeline();
+               doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
+               doReturn(mock(ChannelFuture.class)).when(this.clientListener).close();
+               this.openmsg = new OpenBuilder().setOpenMessage(
+                               new OpenMessageBuilder().setOpen(
+                                               new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder().setDeadTimer(
+                                                               (short) 3).build()).build()).build();
+               this.kamsg = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
        }
 
        /**
         * Both PCEs accept session characteristics. Also tests KeepAliveTimer and error message and when pce attempts to
         * establish pce session for the 2nd time.
         * 
-        * @throws InterruptedException
+        * @throws Exception
         */
        @Test
-       @Ignore
-       public void testSessionCharsAccBoth() throws InterruptedException {
-               // this.serverSession.startSession();
-               assertEquals(1, this.client.getListMsg().size());
-               assertTrue(this.client.getListMsg().get(0) instanceof OpenMessage);
-               // this.client.sendMessage(new PCEPOpenMessage(new PCEPOpenObject(3, 9, 2)));
-               assertEquals(2, this.client.getListMsg().size());
-               assertTrue(this.client.getListMsg().get(1) instanceof KeepaliveMessage);
-               this.client.sendMessage((Message) new KeepaliveMessageBuilder().build());
-               synchronized (this.serverListener) {
-                       while (!this.serverListener.up) {
-                               try {
-                                       this.serverListener.wait();
-                               } catch (final InterruptedException e) {
-                                       e.printStackTrace();
-                               }
-                       }
-               }
-               assertTrue(this.serverListener.up);
+       public void testSessionCharsAccBoth() throws Exception {
+               this.serverSession.channelActive(null);
+               assertEquals(1, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(0) instanceof Open);
+               this.serverSession.handleMessage(this.openmsg);
+               assertEquals(2, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(1) instanceof Keepalive);
+               this.serverSession.handleMessage(this.kamsg);
+               assertEquals(this.serverSession.getState(), DefaultPCEPSessionNegotiator.State.Finished);
                // Thread.sleep(PCEPSessionImpl.KEEP_ALIVE_TIMER_VALUE * 1000);
                // assertEquals(3, this.client.getListMsg().size());
                // assertTrue(this.client.getListMsg().get(2) instanceof PCEPKeepAliveMessage); // test of keepalive timer
@@ -78,62 +126,53 @@ public class FiniteStateMachineTest {
        /**
         * Mock PCE does not accept session characteristics the first time.
         * 
-        * @throws InterruptedException
+        * @throws Exception
         */
        @Test
-       @Ignore
-       public void testSessionCharsAccMe() throws InterruptedException {
-               // this.serverSession.startSession();
-               // this.client.sendMessage(new PCEPOpenMessage(new PCEPOpenObject(4, 9, 2)));
-               assertEquals(2, this.client.getListMsg().size());
-               assertTrue(this.client.getListMsg().get(0) instanceof OpenMessage);
-               assertTrue(this.client.getListMsg().get(1) instanceof KeepaliveMessage);
-               // this.client.sendErrorMessage(PCEPErrors.NON_ACC_NEG_SESSION_CHAR, new PCEPOpenObject(3, 7, 2, null));
-               assertEquals(3, this.client.getListMsg().size());
-               assertTrue(this.client.getListMsg().get(2) instanceof OpenMessage);
-               this.client.sendMessage((Message) new KeepaliveMessageBuilder().build());
-               synchronized (this.serverListener) {
-                       while (!this.serverListener.up) {
-                               try {
-                                       this.serverListener.wait();
-                               } catch (final InterruptedException e) {
-                                       e.printStackTrace();
-                               }
-                       }
-               }
-               assertTrue(this.serverListener.up);
+       public void testSessionCharsAccMe() throws Exception {
+               this.serverSession.channelActive(null);
+               assertEquals(1, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(0) instanceof Open);
+               this.serverSession.handleMessage(this.openmsg);
+               assertEquals(2, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(1) instanceof Keepalive);
+               this.serverSession.handleMessage(createErrorMessageWOpen(PCEPErrors.NON_ACC_NEG_SESSION_CHAR));
+               assertEquals(3, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(2) instanceof Open);
+               this.serverSession.handleMessage(this.kamsg);
+               assertEquals(this.serverSession.getState(), DefaultPCEPSessionNegotiator.State.Finished);
+       }
+
+       private Pcerr createErrorMessageWOpen(PCEPErrors e) {
+               final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
+               return new PcerrBuilder().setPcerrMessage(
+                               new PcerrMessageBuilder().setErrorType(
+                                               new SessionBuilder().setOpen(
+                                                               new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder().setKeepalive(
+                                                                               (short) 1).build()).build()).setErrors(
+                                               Arrays.asList(new ErrorsBuilder().setErrorObject(
+                                                               new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e).type).setValue(
+                                                                               maping.getFromErrorsEnum(e).value).build()).build())).build()).build();
        }
 
        /**
         * Sending different PCEP Message than Open in session establishment phase.
         * 
-        * @throws InterruptedException
+        * @throws Exception
         */
        @Test
-       @Ignore
-       public void testErrorOneOne() throws InterruptedException {
-               // this.serverSession.startSession();
-               assertEquals(1, this.client.getListMsg().size());
-               // assertTrue(this.client.getListMsg().get(0) instanceof OpenMessage);
-               // this.client.sendMessage(new PCEPNotificationMessage(new ArrayList<CompositeNotifyObject>() {
-               // private static final long serialVersionUID = 1L;
-               //
-               // {
-               // this.add(new CompositeNotifyObject(new ArrayList<PCEPNotificationObject>() {
-               // private static final long serialVersionUID = 1L;
-               //
-               // {
-               // this.add(new PCEPNotificationObject((short) 1, (short) 1));
-               // }
-               // }));
-               // }
-               // }));
-               // for (final Message m : this.client.getListMsg()) {
-               // if (m instanceof PCEPErrorMessage) {
-               // final PCEPErrorObject obj = ((PCEPErrorMessage) m).getErrorObjects().get(0);
-               // assertEquals(PCEPErrors.NON_OR_INVALID_OPEN_MSG, obj.getError());
-               // }
-               // }
+       public void testErrorOneOne() throws Exception {
+               this.serverSession.channelActive(null);
+               assertEquals(1, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(0) instanceof Open);
+               this.serverSession.handleMessage(this.kamsg);
+               for (final Notification m : this.receivedMsgs) {
+                       if (m instanceof Pcerr) {
+                               final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
+                               assertEquals(new Short((short) 1), obj.getErrorObject().getType());
+                               assertEquals(new Short((short) 1), obj.getErrorObject().getValue());
+                       }
+               }
        }
 
        /************* Tests commented because of their long duration (tested timers) **************/
@@ -147,8 +186,8 @@ public class FiniteStateMachineTest {
        @Ignore
        public void testErrorOneTwo() throws InterruptedException {
                // this.serverSession.startSession();
-               assertEquals(1, this.client.getListMsg().size());
-               assertTrue(this.client.getListMsg().get(0) instanceof OpenMessage);
+               assertEquals(1, this.receivedMsgs.size());
+               assertTrue(this.receivedMsgs.get(0) instanceof OpenMessage);
                // Thread.sleep(60 * 1000);
                // for (final Message m : this.client.getListMsg()) {
                // if (m instanceof PcerrMessage) {
@@ -182,45 +221,44 @@ public class FiniteStateMachineTest {
        @Test
        @Ignore
        public void testUnknownMessage() throws InterruptedException {
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(1, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(10000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(2, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(10000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(3, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(20000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(4, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(30000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(3, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(10000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(3, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(5000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(4, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(1000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               assertEquals(5, this.serverSession.unknownMessagesTimes.size());
-               Thread.sleep(1000);
-               this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
-               synchronized (this.client) {
-                       while (!this.client.down) {
-                               try {
-                                       this.client.wait();
-                               } catch (final InterruptedException e) {
-                                       e.printStackTrace();
-                               }
-                       }
-               }
-               assertTrue(this.client.down);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(1, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(10000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(2, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(10000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(3, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(20000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(4, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(30000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(3, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(10000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(3, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(5000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(4, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(1000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // assertEquals(5, this.serverSession.unknownMessagesTimes.size());
+               // Thread.sleep(1000);
+               // this.serverSession.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
+               // synchronized (this.client) {
+               // while (!this.client.down) {
+               // try {
+               // this.client.wait();
+               // } catch (final InterruptedException e) {
+               // e.printStackTrace();
+               // }
+               // }
+               // }
+               // assertTrue(this.client.down);
        }
 
        @After
        public void tearDown() {
-               this.serverSession.close();
        }
 }
index aaf0c694b3c5b373c4ac47a829353399954a4170..3fd5ca0632ce6c4c780e98f5b53ad0c3dcc5a6e6 100644 (file)
@@ -23,6 +23,8 @@
         <module>testtool</module>
         <module>topology-api</module>
         <module>topology-provider</module>
+        <module>api-config</module>
+        <module>impl-config</module>
         <module>topology-spi</module>
         <module>tunnel-api</module>
         <module>tunnel-provider</module>
diff --git a/pom.xml b/pom.xml
index 4c1843d4b30cb4df033ac9f3357af234132ac2cc..3ccc6c03d5e2f61535e655bcdf7eea2fef6e2fc5 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,7 @@
                <osgi.version>5.0.0</osgi.version>
 
                <yangtools.version>0.5.9-SNAPSHOT</yangtools.version>
+        <controller.config.version>0.2.2-SNAPSHOT</controller.config.version>
                <yang.binding.version>0.6.0-SNAPSHOT</yang.binding.version>
                <ietf.types.version>2010.09.24.1</ietf.types.version>
        </properties>
                         <configuration>
                             <sources>
                                 <source>target/generated-sources/sal</source>
+                                <source>target/generated-sources/config</source>
                             </sources>
                         </configuration>
                     </execution>