Implement the new alto-northbound with an example 89/29289/2
authorKai GAO <gaok12@mails.tsinghua.edu.cn>
Thu, 5 Nov 2015 03:48:38 +0000 (11:48 +0800)
committerKai GAO <gaok12@mails.tsinghua.edu.cn>
Mon, 9 Nov 2015 00:56:53 +0000 (08:56 +0800)
Patch set 2: fix syntax in standard-northbound-route-aggregator

Change-Id: Ib55e4920110fba5a50d08949b8a993f5cd7e825a
Signed-off-by: Kai GAO <gaok12@mails.tsinghua.edu.cn>
38 files changed:
alto-core/northbound/api/pom.xml [new file with mode: 0644]
alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRoute.java [new file with mode: 0644]
alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRouter.java [new file with mode: 0644]
alto-core/northbound/api/src/main/yang/alto-northbound.yang [new file with mode: 0644]
alto-core/northbound/artifacts/pom.xml [new file with mode: 0644]
alto-core/northbound/features/pom.xml [new file with mode: 0644]
alto-core/northbound/features/src/main/features/features.xml [new file with mode: 0644]
alto-core/northbound/impl/pom.xml [new file with mode: 0644]
alto-core/northbound/impl/src/main/config/default-config.xml [new file with mode: 0644]
alto-core/northbound/impl/src/main/config/maven-metadata-local.xml [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthbound.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundApplication.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundProvider.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundRouterImpl.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModule.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactory.java [new file with mode: 0644]
alto-core/northbound/impl/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]
alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang [new file with mode: 0644]
alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java [new file with mode: 0644]
alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleTest.java [new file with mode: 0644]
alto-core/northbound/it/pom.xml [new file with mode: 0644]
alto-core/northbound/it/src/test/java/org/opendaylight/alto/core/it/AltoNorthboundIT.java [new file with mode: 0644]
alto-core/northbound/karaf/pom.xml [new file with mode: 0644]
alto-core/northbound/pom.xml [new file with mode: 0644]
alto-core/pom.xml
alto-core/standard-northbound-routes/example/pom.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/config/default-config.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/config/maven-metadata-local.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/alto/core/northbound/route/example/impl/AltoNorthboundRouteExample.java [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModule.java [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactory.java [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/main/yang/alto-northbound-route-example-impl.yang [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactoryTest.java [new file with mode: 0644]
alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleTest.java [new file with mode: 0644]
alto-core/standard-northbound-routes/pom.xml [new file with mode: 0644]
alto-core/standard-service-models/model-networkmap/api/pom.xml
alto-core/standard-service-models/model-networkmap/api/src/main/yang/alto-model-networkmap.yang
alto-core/standard-service-models/model-networkmap/impl/src/main/java/org/opendaylight/alto/core/impl/networkmap/test/AltoNetworkmapProvider.java

diff --git a/alto-core/northbound/api/pom.xml b/alto-core/northbound/api/pom.xml
new file mode 100644 (file)
index 0000000..d6ef1c7
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-api</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRoute.java b/alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRoute.java
new file mode 100644 (file)
index 0000000..9ffb1d3
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.alto.core.northbound.api;
+
+public interface AltoNorthboundRoute {
+
+    public static final String ALTO_ERROR = "application/alto-error+json";
+
+}
diff --git a/alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRouter.java b/alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRouter.java
new file mode 100644 (file)
index 0000000..e4441fe
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.alto.core.northbound.api;
+
+public interface AltoNorthboundRouter {
+
+    /*
+     * @return The relative path of the route if successful or null if failing */
+    public String addRoute(String routeName, AltoNorthboundRoute route);
+
+    public void removeRoute(String routeName);
+
+    public AltoNorthboundRoute getRoute(String routeName);
+
+}
diff --git a/alto-core/northbound/api/src/main/yang/alto-northbound.yang b/alto-core/northbound/api/src/main/yang/alto-northbound.yang
new file mode 100644 (file)
index 0000000..e63722e
--- /dev/null
@@ -0,0 +1,28 @@
+module alto-northbound {
+    yang-version 1;
+
+    namespace "urn:opendaylight:alto:core:northbound";
+
+    prefix "alto-northbound";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    organization "Yale University";
+
+    contact "alto-dev@lists.opendaylight.org";
+
+    revision "2015-10-21" {
+        description "Initial revision of alto-northbound model";
+    }
+
+    identity alto-northbound-router {
+        base "config:service-type";
+        config:java-class "org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter";
+    }
+
+    identity alto-northbound-route {
+        base "config:service-type";
+        config:java-class "org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute";
+    }
+
+}
diff --git a/alto-core/northbound/artifacts/pom.xml b/alto-core/northbound/artifacts/pom.xml
new file mode 100644 (file)
index 0000000..fb91c14
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<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">
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-artifacts</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>alto-northbound-api</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>alto-northbound-impl</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>alto-northbound-features</artifactId>
+        <version>${project.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>
diff --git a/alto-core/northbound/features/pom.xml b/alto-core/northbound/features/pom.xml
new file mode 100644 (file)
index 0000000..236fd05
--- /dev/null
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<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.odlparent</groupId>
+    <artifactId>features-parent</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-features</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <name>${project.artifactId}</name>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.1.1</maven>
+  </prerequisites>
+  <properties>
+    <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.version>
+    <mdsal.version>1.3.0-SNAPSHOT</mdsal.version>
+    <restconf.version>1.3.0-SNAPSHOT</restconf.version>
+    <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+    <dlux.version>0.3.0-SNAPSHOT</dlux.version>
+    <configfile.directory>etc/opendaylight/karaf</configfile.directory>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <!-- project specific dependencies -->
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>${mdsal.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>restconf-artifacts</artifactId>
+        <version>${restconf.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>features-yangtools</artifactId>
+      <classifier>features</classifier>
+      <version>${yangtools.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>features-mdsal-model</artifactId>
+      <version>${mdsal.model.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>features-mdsal</artifactId>
+      <classifier>features</classifier>
+      <version>${mdsal.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.netconf</groupId>
+      <artifactId>features-restconf</artifactId>
+      <classifier>features</classifier>
+      <version>${restconf.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.dlux</groupId>
+      <artifactId>features-dlux</artifactId>
+      <classifier>features</classifier>
+      <version>${dlux.version}</version>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-impl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-impl</artifactId>
+      <version>${project.version}</version>
+      <type>xml</type>
+      <classifier>config</classifier>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-route-example</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-route-example</artifactId>
+      <version>${project.version}</version>
+      <type>xml</type>
+      <classifier>config</classifier>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/alto-core/northbound/features/src/main/features/features.xml b/alto-core/northbound/features/src/main/features/features.xml
new file mode 100644 (file)
index 0000000..99a9616
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<features name="odl-alto-northbound-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+  <repository>mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/${mdsal.model.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.netconf/features-restconf/${restconf.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.version}/xml/features</repository>
+  <feature name='odl-alto-northbound-api' version='${project.version}' description='OpenDaylight :: alto-northbound :: api'>
+    <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+    <feature version="${restconf.version}">odl-restconf</feature>
+    <bundle>mvn:org.opendaylight.alto.core/alto-northbound-api/${project.version}</bundle>
+  </feature>
+  <feature name='odl-alto-northbound' version='${project.version}' description='OpenDaylight :: alto-northbound'>
+    <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+    <feature version='${project.version}'>odl-alto-northbound-api</feature>
+    <bundle>mvn:org.opendaylight.alto.core/alto-northbound-impl/${project.version}</bundle>
+    <configfile finalname="${configfile.directory}/alto-northbound.xml">mvn:org.opendaylight.alto.core/alto-northbound-impl/${project.version}/xml/config</configfile>
+  </feature>
+  <feature name='odl-alto-northbound-route-test' version='${project.version}' description='OpenDaylight :: ALTO :: Route Exmaple'>
+      <feature version='${project.version}'>odl-alto-northbound</feature>
+      <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-example/${project.version}</bundle>
+      <configfile finalname="${configfile.directory}/alto-northbound-route-example.xml">mvn:org.opendaylight.alto.core/alto-northbound-route-example/${project.version}/xml/config</configfile>
+  </feature>
+  <feature name='odl-alto-northbound-rest' version='${project.version}' description='OpenDaylight :: alto-northbound :: REST'>
+    <feature version="${project.version}">odl-alto-northbound</feature>
+    <feature version="${project.version}">odl-alto-northbound-route-test</feature>
+  </feature>
+  <feature name='odl-alto-northbound-ui' version='${project.version}' description='OpenDaylight :: alto-northbound :: UI'>
+    <feature version="${project.version}">odl-alto-northbound-rest</feature>
+    <feature version="${restconf.version}">odl-mdsal-apidocs</feature>
+    <feature version="${mdsal.version}">odl-mdsal-xsql</feature>
+    <feature version="${dlux.version}">odl-dlux-yangui</feature>
+  </feature>
+
+</features>
diff --git a/alto-core/northbound/impl/pom.xml b/alto-core/northbound/impl/pom.xml
new file mode 100644 (file)
index 0000000..04692bc
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-impl</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- Testing Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.datatype</groupId>
+      <artifactId>jackson-datatype-json-org</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.module</groupId>
+      <artifactId>jackson-module-jaxb-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle.plugin.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>*,com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets</Import-Package>
+            <Web-ContextPath>/alto</Web-ContextPath>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/alto-core/northbound/impl/src/main/config/default-config.xml b/alto-core/northbound/impl/src/main/config/default-config.xml
new file mode 100644 (file)
index 0000000..06d7fee
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+  <required-capabilities>
+      <capability>urn:opendaylight:alto:core:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
+      <capability>urn:opendaylight:alto:core:northbound:impl?module=alto-northbound-impl&amp;revision=2015-10-21</capability>
+      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+  </required-capabilities>
+  <configuration>
+
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <module>
+          <type xmlns:prefix="urn:opendaylight:alto:core:northbound:impl">prefix:alto-northbound</type>
+          <name>alto-northbound-default</name>
+          <broker>
+            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+            <name>binding-osgi-broker</name>
+          </broker>
+        </module>
+      </modules>
+
+      <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <service>
+          <type xmlns:alto-northbound="urn:opendaylight:alto:core:northbound">alto-northbound:alto-northbound-router</type>
+          <instance>
+            <name>alto-northbound-router</name>
+            <provider>/modules/module[type='alto-northbound'][name='alto-northbound-default']</provider>
+          </instance>
+        </service>
+      </services>
+    </data>
+  </configuration>
+</snapshot>
diff --git a/alto-core/northbound/impl/src/main/config/maven-metadata-local.xml b/alto-core/northbound/impl/src/main/config/maven-metadata-local.xml
new file mode 100644 (file)
index 0000000..f403e79
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-impl</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <versioning>
+    <snapshot>
+      <localCopy>true</localCopy>
+    </snapshot>
+    <lastUpdated>20151105030453</lastUpdated>
+    <snapshotVersions>
+      <snapshotVersion>
+        <classifier>config</classifier>
+        <extension>xml</extension>
+        <value>0.2.0-SNAPSHOT</value>
+        <updated>20151105030453</updated>
+      </snapshotVersion>
+    </snapshotVersions>
+  </versioning>
+</metadata>
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthbound.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthbound.java
new file mode 100644 (file)
index 0000000..9f13614
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.alto.core.northbound.impl;
+
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+@Path("/")
+public class AltoNorthbound {
+
+    private AltoNorthboundRouterImpl router = AltoNorthboundRouterImpl.getInstance();
+
+    @Path("{routeName}")
+    public AltoNorthboundRoute route(@PathParam("routeName") String routeName) {
+        return router.getRoute(routeName);
+    }
+
+}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundApplication.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundApplication.java
new file mode 100644 (file)
index 0000000..2377241
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.alto.core.northbound.impl;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+public class AltoNorthboundApplication extends Application {
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(AltoNorthbound.class);
+        return classes;
+    }
+}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundProvider.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundProvider.java
new file mode 100644 (file)
index 0000000..989043a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.alto.core.northbound.impl;
+
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AltoNorthboundProvider implements BindingAwareProvider, AutoCloseable, AltoNorthboundRouter{
+
+    private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundProvider.class);
+
+    private AltoNorthboundRouterImpl router = AltoNorthboundRouterImpl.getInstance();
+
+    @Override
+    public void onSessionInitiated(ProviderContext session) {
+        LOG.info("AltoNorthboundProvider Session Initiated");
+    }
+
+    @Override
+    public void close() throws Exception {
+        LOG.info("AltoNorthboundProvider Closed");
+    }
+
+    @Override
+    public String addRoute(String routeName, AltoNorthboundRoute route) {
+        return router.addRoute(routeName, route);
+    }
+
+    @Override
+    public void removeRoute(String routeName) {
+        router.removeRoute(routeName);
+    }
+
+    @Override
+    public AltoNorthboundRoute getRoute(String routeName) {
+        return router.getRoute(routeName);
+    }
+
+}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundRouterImpl.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundRouterImpl.java
new file mode 100644 (file)
index 0000000..4d758d1
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.alto.core.northbound.impl;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
+
+public class AltoNorthboundRouterImpl implements AltoNorthboundRouter {
+
+    private ConcurrentHashMap<String, AltoNorthboundRoute> routes;
+
+    private static AltoNorthboundRouterImpl singleton = new AltoNorthboundRouterImpl();
+
+    protected AltoNorthboundRouterImpl() {
+        routes = new ConcurrentHashMap<String, AltoNorthboundRoute>();
+    }
+
+    public static AltoNorthboundRouterImpl getInstance() {
+        return singleton;
+    }
+
+    @Override
+    public String addRoute(String routeName, AltoNorthboundRoute route) {
+        if (routes.contains(routeName)) {
+            return null;
+        }
+        routes.put(routeName, route);
+        return "/alto/" + routeName;
+    }
+
+    @Override
+    public AltoNorthboundRoute getRoute(String routeName) {
+        return routes.get(routeName);
+    }
+
+    @Override
+    public void removeRoute(String routeName) {
+        if (!routes.contains(routeName)) {
+            return;
+        }
+        routes.remove(routeName);
+    }
+}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModule.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModule.java
new file mode 100644 (file)
index 0000000..abcf256
--- /dev/null
@@ -0,0 +1,27 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021;
+
+import org.opendaylight.alto.core.northbound.impl.AltoNorthboundProvider;
+
+public class AltoNorthboundModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021.AbstractAltoNorthboundModule {
+    public AltoNorthboundModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public AltoNorthboundModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021.AltoNorthboundModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        AltoNorthboundProvider provider = new AltoNorthboundProvider();
+
+        getBrokerDependency().registerProvider(provider);
+        return provider;
+    }
+
+}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactory.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactory.java
new file mode 100644 (file)
index 0000000..a8d93c0
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: northbound-impl yang module local name: alto-northbound
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Nov 05 10:05:41 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021;
+public class AltoNorthboundModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021.AbstractAltoNorthboundModuleFactory {
+
+}
diff --git a/alto-core/northbound/impl/src/main/resources/WEB-INF/web.xml b/alto-core/northbound/impl/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..9b964c1
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+    version="3.0">
+    <servlet>
+        <servlet-name>org.opendaylight.alto.core.northbound.AltoNorthboundApplication</servlet-name>
+        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.opendaylight.alto.core.northbound.impl.AltoNorthboundApplication</param-value>
+        </init-param>
+        <init-param>
+            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>org.opendaylight.alto.core.northbound.AltoNorthboundApplication</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+    <filter>
+        <filter-name>cross-origin-restconf</filter-name>
+        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
+        <init-param>
+            <param-name>allowedOrigins</param-name>
+            <param-value>*</param-value>
+        </init-param>
+        <init-param>
+            <param-name>allowedMethods</param-name>
+            <param-value>GET,POST,OPTIONS,DELETE,PUT,HEAD</param-value>
+        </init-param>
+        <init-param>
+            <param-name>allowedHeaders</param-name>
+            <param-value>origin, content-type, accept, authorization, Authorization</param-value>
+        </init-param>
+    </filter>
+    <filter-mapping>
+        <filter-name>cross-origin-restconf</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name></web-resource-name>
+            <url-pattern>/*</url-pattern>
+            <http-method>POST</http-method>
+            <http-method>GET</http-method>
+            <http-method>PUT</http-method>
+            <http-method>PATCH</http-method>
+            <http-method>DELETE</http-method>
+            <http-method>HEAD</http-method>
+        </web-resource-collection>
+    </security-constraint>
+</web-app>
diff --git a/alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang b/alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang
new file mode 100644 (file)
index 0000000..13846e9
--- /dev/null
@@ -0,0 +1,37 @@
+module alto-northbound-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:alto:core:northbound:impl";
+    prefix "alto-northbound-impl";
+
+    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+    description
+        "Service definition for northbound project";
+
+    revision "2015-10-21" {
+        description
+            "Initial revision";
+    }
+
+    identity alto-northbound {
+        base config:module-type;
+        config:provided-service alto-northbound:alto-northbound-router;
+        config:java-name-prefix AltoNorthbound;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case alto-northbound {
+            when "/config:modules/config:module/config:type = 'alto-northbound'";
+            container broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java b/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java
new file mode 100644 (file)
index 0000000..84a9b83
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021;
+
+import org.junit.Test;
+
+public class AltoNorthboundModuleFactoryTest {
+    @Test
+    public void testFactoryConstructor() {
+        // ensure no exceptions on construction
+        new AltoNorthboundModuleFactory();
+    }
+}
diff --git a/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleTest.java b/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/impl/rev151021/AltoNorthboundModuleTest.java
new file mode 100644 (file)
index 0000000..03d2761
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.impl.rev151021;
+
+import org.junit.Test;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.JmxAttribute;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.alto.core.northbound.impl.AltoNorthboundProvider;
+
+import javax.management.ObjectName;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class AltoNorthboundModuleTest {
+    @Test
+    public void testCustomValidation() {
+        AltoNorthboundModule module = new AltoNorthboundModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
+
+        // ensure no exceptions on validation
+        // currently this method is empty
+        module.customValidation();
+    }
+
+    @Test
+    public void testCreateInstance() throws Exception {
+        // configure mocks
+        DependencyResolver dependencyResolver = mock(DependencyResolver.class);
+        BindingAwareBroker broker = mock(BindingAwareBroker.class);
+        when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
+
+        // create instance of module with injected mocks
+        AltoNorthboundModule module = new AltoNorthboundModule(mock(ModuleIdentifier.class), dependencyResolver);
+
+        // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
+        AutoCloseable closeable = module.getInstance();
+
+        // verify that the module registered the returned provider with the broker
+        verify(broker).registerProvider((AltoNorthboundProvider)closeable);
+
+        // ensure no exceptions on close
+        closeable.close();
+    }
+}
diff --git a/alto-core/northbound/it/pom.xml b/alto-core/northbound/it/pom.xml
new file mode 100644 (file)
index 0000000..09db296
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<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.controller</groupId>
+    <artifactId>mdsal-it-parent</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-it</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skipITs>false</skipITs>
+    <karaf.distro.groupId>org.opendaylight.alto.core</karaf.distro.groupId>
+    <karaf.distro.artifactId>alto-northbound-karaf</karaf.distro.artifactId>
+    <karaf.distro.version>0.2.0-SNAPSHOT</karaf.distro.version>
+    <karaf.distro.type>zip</karaf.distro.type>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-features</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/alto-core/northbound/it/src/test/java/org/opendaylight/alto/core/it/AltoNorthboundIT.java b/alto-core/northbound/it/src/test/java/org/opendaylight/alto/core/it/AltoNorthboundIT.java
new file mode 100644 (file)
index 0000000..3fc2388
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.alto.core.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AltoNorthboundIT extends AbstractMdsalTestBase {
+    private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundIT.class);
+
+    @Override
+    public String getModuleName() {
+        return "alto-northbound";
+    }
+
+    @Override
+    public String getInstanceName() {
+        return "alto-northbound-default";
+    }
+
+    @Override
+    public MavenUrlReference getFeatureRepo() {
+        return maven()
+                .groupId("org.opendaylight.alto.core")
+                .artifactId("alto-northbound-features")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+    }
+
+    @Override
+    public String getFeatureName() {
+        return "odl-alto-northbound-ui";
+    }
+
+    @Override
+    public Option getLoggingOption() {
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                logConfiguration(AltoNorthboundIT.class),
+                LogLevel.INFO.name());
+        option = composite(option, super.getLoggingOption());
+        return option;
+    }
+
+    @Test
+    public void testnorthboundFeatureLoad() {
+        Assert.assertTrue(true);
+    }
+}
diff --git a/alto-core/northbound/karaf/pom.xml b/alto-core/northbound/karaf/pom.xml
new file mode 100644 (file)
index 0000000..9ee23ad
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<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.controller</groupId>
+    <artifactId>karaf-parent</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-karaf</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <name>${project.artifactId}</name>
+  <prerequisites>
+    <maven>3.1.1</maven>
+  </prerequisites>
+  <properties>
+    <karaf.localFeature>odl-alto-northbound-ui</karaf.localFeature>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>alto-northbound-artifacts</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <!-- scope is compile so all features (there is only one) are installed
+      into startup.properties and the feature repo itself is not installed -->
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>framework</artifactId>
+      <type>kar</type>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-features</artifactId>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+  <!-- DO NOT install or deploy the karaf artifact -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/alto-core/northbound/pom.xml b/alto-core/northbound/pom.xml
new file mode 100644 (file)
index 0000000..6a946d7
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<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.odlparent</groupId>
+    <artifactId>odlparent</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-aggregator</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <name>alto-northbound</name>
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.1.1</maven>
+  </prerequisites>
+
+  <profiles>
+    <profile>
+      <id>minimal</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <modules>
+        <module>api</module>
+        <module>impl</module>
+      </modules>
+    </profile>
+
+    <profile>
+      <id>alto-dev</id>
+      <modules>
+        <module>api</module>
+        <module>impl</module>
+        <module>fetures</module>
+        <module>artifacts</module>
+      </modules>
+    </profile>
+
+    <profile>
+      <id>alto-test</id>
+      <modules>
+        <module>api</module>
+        <module>impl</module>
+        <module>karaf</module>
+        <module>features</module>
+        <module>artifacts</module>
+        <module>it</module>
+      </modules>
+    </profile>
+  </profiles>
+  <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/alto-northbound.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/alto-northbound.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/alto-northbound:Main</url>
+  </scm>
+</project>
index 4261bd8151c0e8a9717043571016f35414d50d58..a494176ad3df44f6726204fcb6799bb861b459cd 100644 (file)
@@ -26,6 +26,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     <module>basic-types</module>
     <module>resourcepool</module>
     <module>standard-service-models</module>
+    <module>northbound</module>
+    <module>standard-northbound-routes</module>
   </modules>
   <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
   <build>
diff --git a/alto-core/standard-northbound-routes/example/pom.xml b/alto-core/standard-northbound-routes/example/pom.xml
new file mode 100644 (file)
index 0000000..30fddb4
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-route-example</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>alto-northbound-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- Testing Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.datatype</groupId>
+      <artifactId>jackson-datatype-json-org</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.module</groupId>
+      <artifactId>jackson-module-jaxb-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle.plugin.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>*,com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets</Import-Package>
+            <Web-ContextPath>/alto</Web-ContextPath>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/alto-core/standard-northbound-routes/example/src/main/config/default-config.xml b/alto-core/standard-northbound-routes/example/src/main/config/default-config.xml
new file mode 100644 (file)
index 0000000..2fc052e
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Yale University and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+  <required-capabilities>
+      <capability>urn:opendaylight:alto:core:northbound:route:example:impl?module=alto-northbound-route-example-impl&amp;revision=2015-10-21</capability>
+      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+      <capability>urn:opendaylight:alto:core:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
+  </required-capabilities>
+  <configuration>
+
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <module>
+          <type xmlns:prefix="urn:opendaylight:alto:core:northbound:route:example:impl">prefix:alto-northbound-route-example-impl</type>
+          <name>alto-northbound-route-example</name>
+          <broker>
+            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+            <name>binding-osgi-broker</name>
+          </broker>
+          <alto-northbound-router>
+            <type xmlns:alto-northbound-router="urn:opendaylight:alto:core:northbound">alto-northbound-router:alto-northbound-router</type>
+            <name>alto-northbound-router</name>
+          </alto-northbound-router>
+        </module>
+      </modules>
+    </data>
+  </configuration>
+</snapshot>
diff --git a/alto-core/standard-northbound-routes/example/src/main/config/maven-metadata-local.xml b/alto-core/standard-northbound-routes/example/src/main/config/maven-metadata-local.xml
new file mode 100644 (file)
index 0000000..f403e79
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>alto-northbound-impl</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <versioning>
+    <snapshot>
+      <localCopy>true</localCopy>
+    </snapshot>
+    <lastUpdated>20151105030453</lastUpdated>
+    <snapshotVersions>
+      <snapshotVersion>
+        <classifier>config</classifier>
+        <extension>xml</extension>
+        <value>0.2.0-SNAPSHOT</value>
+        <updated>20151105030453</updated>
+      </snapshotVersion>
+    </snapshotVersions>
+  </versioning>
+</metadata>
diff --git a/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/alto/core/northbound/route/example/impl/AltoNorthboundRouteExample.java b/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/alto/core/northbound/route/example/impl/AltoNorthboundRouteExample.java
new file mode 100644 (file)
index 0000000..a1900db
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.alto.core.northbound.route.example.impl;
+
+import javax.servlet.http.HttpServletRequest;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
+
+@Path("/")
+public class AltoNorthboundRouteExample implements AltoNorthboundRoute {
+
+    @Path("{echo}")
+    @GET
+    @Produces("application/alto-test+json")
+    public String route(@Context HttpServletRequest req, @PathParam("echo") String echo) {
+        if (req == null) {
+            System.out.println("We are screwed");
+        }
+        return "Hello world! " + echo
+                + "\nFrom: " + req.getContextPath() + "/" + req.getPathTranslated()
+                + "\nTo: " + req.getRemoteAddr();
+    }
+
+}
diff --git a/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModule.java b/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModule.java
new file mode 100644 (file)
index 0000000..a6eb34f
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021;
+
+import org.opendaylight.alto.core.northbound.route.example.impl.AltoNorthboundRouteExample;
+
+public class AltoNorthboundRouteExampleModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021.AbstractAltoNorthboundRouteExampleModule {
+    public AltoNorthboundRouteExampleModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public AltoNorthboundRouteExampleModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021.AltoNorthboundRouteExampleModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        getAltoNorthboundRouterDependency().addRoute("example", new AltoNorthboundRouteExample());
+        System.out.println("haha");
+
+        return new AutoCloseable() {
+            @Override
+            public void close() {
+                getAltoNorthboundRouterDependency().removeRoute("example");
+            }
+        };
+    }
+
+}
diff --git a/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactory.java b/alto-core/standard-northbound-routes/example/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactory.java
new file mode 100644 (file)
index 0000000..0ba8754
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: alto-northbound-route-example-impl yang module local name: alto-northbound-route-example-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Nov 05 12:06:09 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021;
+public class AltoNorthboundRouteExampleModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021.AbstractAltoNorthboundRouteExampleModuleFactory {
+
+}
diff --git a/alto-core/standard-northbound-routes/example/src/main/yang/alto-northbound-route-example-impl.yang b/alto-core/standard-northbound-routes/example/src/main/yang/alto-northbound-route-example-impl.yang
new file mode 100644 (file)
index 0000000..a3d636c
--- /dev/null
@@ -0,0 +1,45 @@
+module alto-northbound-route-example-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:alto:core:northbound:route:example:impl";
+    prefix "alto-northbound-router-example-impl";
+
+    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+    description
+        "Service definition for northbound project";
+
+    revision "2015-10-21" {
+        description
+            "Initial revision";
+    }
+
+    identity alto-northbound-route-example-impl {
+        base config:module-type;
+        config:java-name-prefix AltoNorthboundRouteExample;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case alto-northbound-route-example {
+            when "/config:modules/config:module/config:type = 'alto-northbound-route-example-impl'";
+            container broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
+                    }
+                }
+            }
+
+            container alto-northbound-router {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity alto-northbound:alto-northbound-router;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactoryTest.java b/alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleFactoryTest.java
new file mode 100644 (file)
index 0000000..5260fcc
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021;
+
+import org.junit.Test;
+
+public class AltoNorthboundRouteExampleModuleFactoryTest {
+    @Test
+    public void testFactoryConstructor() {
+        // ensure no exceptions on construction
+        new AltoNorthboundRouteExampleModuleFactory();
+    }
+}
diff --git a/alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleTest.java b/alto-core/standard-northbound-routes/example/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/alto/core/northbound/route/example/impl/rev151021/AltoNorthboundRouteExampleModuleTest.java
new file mode 100644 (file)
index 0000000..b63273c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2015 Yale University and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.northbound.route.example.impl.rev151021;
+
+import org.junit.Test;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.JmxAttribute;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
+
+import javax.management.ObjectName;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class AltoNorthboundRouteExampleModuleTest {
+    @Test
+    public void testCustomValidation() {
+        AltoNorthboundRouteExampleModule module = new AltoNorthboundRouteExampleModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
+
+        // ensure no exceptions on validation
+        // currently this method is empty
+        module.customValidation();
+    }
+
+    @Test
+    public void testCreateInstance() throws Exception {
+        // configure mocks
+        DependencyResolver dependencyResolver = mock(DependencyResolver.class);
+        BindingAwareBroker broker = mock(BindingAwareBroker.class);
+        AltoNorthboundRouter router = mock(AltoNorthboundRouter.class);
+        when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
+        when(dependencyResolver.resolveInstance(eq(AltoNorthboundRouter.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(router);
+
+        // create instance of module with injected mocks
+        AltoNorthboundRouteExampleModule module = new AltoNorthboundRouteExampleModule(mock(ModuleIdentifier.class), dependencyResolver);
+
+        // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
+        AutoCloseable closeable = module.getInstance();
+
+        // ensure no exceptions on close
+        closeable.close();
+
+        // verify that the route is released after closed
+        verify(router).removeRoute("example");
+    }
+}
diff --git a/alto-core/standard-northbound-routes/pom.xml b/alto-core/standard-northbound-routes/pom.xml
new file mode 100644 (file)
index 0000000..de7c572
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Copyright (c) Yale University and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+--><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.odlparent</groupId>
+    <artifactId>odlparent</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.alto.core</groupId>
+  <artifactId>standard-northbound-routes-aggregator</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <name>alto-standard-nb-routes-aggregator</name>
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.1.1</maven>
+  </prerequisites>
+
+  <profiles>
+    <profile>
+      <id>minimal</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <!--
+      <modules>
+        <module>networkmap</module>
+      </modules>
+    -->
+    </profile>
+
+    <profile>
+      <id>alto-test</id>
+      <modules>
+        <module>example</module>
+      </modules>
+    </profile>
+  </profiles>
+  <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
index d7a0cda483b6cc44d7c1a7e5ede1529d75a4c023..23a50e2a8807780c4018039549bc8d1ac2a37dce 100644 (file)
@@ -48,5 +48,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>org.opendaylight.mdsal.model</groupId>
       <artifactId>ietf-inet-types-2013-07-15</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>yang-ext</artifactId>
+    </dependency>
   </dependencies>
 </project>
index 96b2c612027449fdad47cf09798a2e5b33498145..8edfacef560d49d5f684e4559cb454a5d1dfe047 100644 (file)
@@ -21,6 +21,10 @@ module alto-model-networkmap {
         prefix "ietf-inet";
     }
 
+    import yang-ext {
+        prefix ext;
+    }
+
     organization "Yale University";
 
     contact "alto-dev@lists.opendaylight.org";
@@ -35,13 +39,13 @@ module alto-model-networkmap {
             "The resource type for network map";
     }
 
-    identity "property-type" {
+    identity "property-type-base" {
         description
             "Base type for PID properties";
     }
 
     identity "address-type-base" {
-        base "property-type";
+        base "property-type-base";
         description
             "Base type for address type";
     }
@@ -53,8 +57,8 @@ module alto-model-networkmap {
             }
 
             leaf-list "address-type" {
-                type "identityref" {
-                    base "alto-model-networkmap:address-type-base";
+                type identityref {
+                    base "address-type-base";
                 }
             }
         }
@@ -73,8 +77,8 @@ module alto-model-networkmap {
                     key "property-type";
 
                     leaf "property-type" {
-                        type "identityref" {
-                            base "alto-model-networkmap:property-type";
+                        type identityref {
+                            base "property-type-base";
                         }
                     }
 
@@ -86,13 +90,16 @@ module alto-model-networkmap {
     }
 
     augment "/base:query/base:input/base:request" {
-        case "networkmap-request-data" {
+        ext:augment-identifier "alto-networkmap-request";
+
+        case "alto-networkmap-request" {
             uses "networkmap-request-data";
         }
     }
 
     augment "/base:query/base:output/base:response" {
-        case "networkmap-response-data" {
+        ext:augment-identifier "alto-networkmap-response";
+        case "alto-networkmap-response" {
             uses "networkmap-response-data";
         }
     }
@@ -109,7 +116,9 @@ module alto-model-networkmap {
             "Address type for IPv6";
     }
 
-    augment "/base:query/base:output/base:response/networkmap-response-data/network-map/partition/property/data" {
+    augment "/base:query/base:output/base:response/alto-networkmap-response/network-map/partition/property/data" {
+        ext:augment-identifier "rfc7285-networkmap-property-data";
+
         case ipv4 {
             leaf-list "ipv4" {
                 type ietf-inet:ipv4-prefix;
index 095d16b3976c459ff4716df98e20cfd3e23aa3ae..8c706b278a201aec00921d0b821e21e65ee622a4 100644 (file)
@@ -41,10 +41,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkm
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.PartitionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.partition.Property;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.networkmap.response.data.network.map.partition.PropertyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.input.request.NetworkmapRequestData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.NetworkmapResponseDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.networkmap.response.data.network.map.partition.property.data.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.networkmap.response.data.network.map.partition.property.data.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.input.request.AltoNetworkmapRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.AltoNetworkmapResponseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.alto.networkmap.response.network.map.partition.property.data.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.networkmap.rev151021.query.output.response.alto.networkmap.response.network.map.partition.property.data.Ipv6Builder;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.AltoModelBaseService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.service.model.rev151021.QueryInput;
@@ -113,7 +113,7 @@ public class AltoNetworkmapProvider implements BindingAwareProvider, AutoCloseab
         if (!input.getType().equals(ResourceTypeNetworkmap.class)) {
             return RpcResultBuilder.<QueryOutput>failed().buildFuture();
         }
-        NetworkmapRequestData request = (NetworkmapRequestData)input.getRequest();
+        AltoNetworkmapRequest request = (AltoNetworkmapRequest)input.getRequest();
         NetworkmapFilter filter = request.getNetworkmapFilter();
 
         List<PidName> pids = filter.getPid();
@@ -157,7 +157,7 @@ public class AltoNetworkmapProvider implements BindingAwareProvider, AutoCloseab
         NetworkMapBuilder nmBuilder = new NetworkMapBuilder();
         nmBuilder.setPartition(partitionList);
 
-        NetworkmapResponseDataBuilder nmrBuilder = new NetworkmapResponseDataBuilder();
+        AltoNetworkmapResponseBuilder nmrBuilder = new AltoNetworkmapResponseBuilder();
         nmrBuilder.setNetworkMap(nmBuilder.build());
 
         QueryOutputBuilder builder = new QueryOutputBuilder();