**/*.checkstyle
**/*.swo
.zsh*
+.helper
+eclimd.log
+*.xmi
--- /dev/null
+
+# TODO
+
+1. Use [routed RPC service][routed-rpc] to implement ALTO instances. Also see
+ [examples][routed-rpc-example].
+
+[routed-rpc]: https://ask.opendaylight.org/question/99/how-does-request-routing-works/
+[routed-rpc-example]: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blob;f=opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.jav=d49d6f0e25e271e43c8550feb5eef63d9630118b=HEAD4a
--- /dev/null
+<?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>features-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types-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.version>1.3.0-SNAPSHOT</mdsal.version>
+ <restconf.version>1.3.0-SNAPSHOT</restconf.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+ <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.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.controller</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <version>${mdsal.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+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
+-->
+<features name="odl-alto-resourcepool-${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.controller/features-mdsal/${mdsal.version}/xml/features</repository>
+ <feature name='odl-alto-basic-types' version='${project.version}' description='OpenDaylight :: ALTO :: basic-types'>
+ <!-- FIXME: Bug 4202: Switch to MD-SAL provided odl-mdsal-models-base -->
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-basic-types/${project.version}</bundle>
+ </feature>
+</features>
--- /dev/null
+<?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
+-->
+<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.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+</project>
--- /dev/null
+module alto-basic-types {
+ yang-version 1;
+
+ namespace "urn:opendaylight:alto:core:types";
+
+ prefix "alto-basic-types";
+
+ organization "Yale University";
+
+ contact "alto-dev@lists.opendaylight.org";
+
+ revision "2015-09-21" {
+ description "Initial revision of alto core types";
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.1 */
+ typedef "pid-name" {
+ type string {
+ pattern "[0-9a-zA-Z\-:@_]*";
+ length "1..64";
+ }
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.2 */
+ typedef "resource-id" {
+ type string {
+ pattern "[0-9a-zA-Z\-:@_]*";
+ length "1..64";
+ }
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.3 */
+ typedef "tag" {
+ type string {
+ pattern "[!-~]*";
+ length "1..32";
+ }
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.6 */
+ typedef "cost-metric" {
+ type string {
+ pattern "[0-9a-zA-Z\-_:]*";
+ length "1..32";
+ }
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.8.1 */
+ typedef "specific-endpoint-property" {
+ type string {
+ pattern "[0-9a-zA-Z\-:@_]{1,64}\.[0-9a-zA-Z\-:_]{1,32}";
+ length "3..97";
+ }
+ }
+
+ /* See https://tools.ietf.org/html/rfc7285#section-10.8.2 */
+ typedef "global-endpoint-property" {
+ type string {
+ pattern "[0-9a-zA-Z\-:_]*";
+ length "1..32";
+ }
+ }
+
+}
--- /dev/null
+<?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>
+ </parent>
+
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types-aggregator</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>alto-core-aggregator</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <modules>
+ <module>model</module>
+ <module>features</module>
+ </modules>
+ <!-- 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>
--- /dev/null
+<?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>
+ </parent>
+
+ <groupId>org.opendaylight.alto</groupId>
+ <artifactId>core-aggregator</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>alto-core-aggregator</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <modules>
+ <module>basic-types</module>
+ <module>resourcepool</module>
+ </modules>
+ <!-- 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>
--- /dev/null
+<?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
+-->
+<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.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-resourcepool-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>yang-ext</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types-2013-07-15</artifactId>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+module alto-resourcepool {
+ yang-version 1;
+
+ namespace "urn:opendaylight:alto:core:resourcepool";
+
+ prefix "alto-resourcepool";
+
+ import "alto-basic-types" {
+ prefix "alto-types";
+ }
+
+ import "yang-ext" {
+ prefix "yang-ext";
+ }
+
+ import "ietf-inet-types" {
+ prefix "ietf-inet";
+ }
+
+ organization "Yale University";
+
+ contact "alto-dev@lists.opendaylight.org";
+
+ revision "2015-09-21" {
+ description "Initial revision of alto resourcepool";
+ }
+
+ identity "service-context" {
+ description
+ "The context identifier for a certain ALTO service";
+ }
+
+ identity "resource-type" {
+ description
+ "The basic type identity for ALTO resourcepool";
+ }
+
+ identity "capability-category" {
+ description
+ "The basic identity for capability categories";
+ }
+
+ grouping "capability-spec" {
+ container "spec" {
+ leaf "category" {
+ type identityref {
+ base "capability-category";
+ }
+ }
+ }
+ }
+
+ /* Examples to extend the capability spec
+ grouping "cost-type-spec" {
+ uses "capability-spec" {
+ augment "spec" {
+ container "cost-type" {
+ leaf "cost-metric" {
+ type string;
+ }
+
+ leaf "cost-mode" {
+ type string;
+ }
+ }
+ }
+ }
+ }
+ */
+
+ grouping "resource-desc" {
+ leaf "resource-id" {
+ type alto-types:resource-id;
+ }
+
+ leaf "local" {
+ type boolean;
+ default true;
+ }
+
+ leaf "uri" {
+ type ietf-inet:uri;
+ }
+
+ leaf "type" {
+ type identityref {
+ base "resource-type";
+ }
+ }
+
+ list "capability" {
+ uses "capability-spec";
+ }
+
+ list "dependency" {
+ leaf "resource-id" {
+ type alto-types:resource-id;
+ }
+ }
+ }
+
+ grouping "resource-service" {
+ leaf "service-instance" {
+ type instance-identifier;
+ }
+ }
+
+ container "resource-pool" {
+ config false;
+
+ list "resource" {
+ key "resource-id";
+
+ yang-ext:context-instance "service-context";
+
+ uses "resource-desc";
+
+ uses "resource-service";
+
+ leaf "refcount" {
+ type uint16;
+ }
+
+ leaf "tag" {
+ type alto-types:tag;
+ }
+ }
+ }
+
+ rpc "add-resource" {
+ input {
+ uses "resource-desc";
+
+ uses "resource-service";
+ }
+ }
+
+ rpc "remove-resource" {
+ input {
+ leaf "resource-id" {
+ type alto-types:resource-id;
+ }
+ }
+ }
+
+ rpc "update-resource" {
+ input {
+ uses "resource-desc";
+
+ uses "resource-service";
+ }
+ }
+
+ rpc "verify-resource" {
+ input {
+ uses "resource-desc";
+
+ uses "resource-service";
+ }
+ }
+}
--- /dev/null
+<?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
+-->
+
+<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-resourcepool-artifacts</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
--- /dev/null
+<?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>features-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-resourcepool-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.version>1.3.0-SNAPSHOT</mdsal.version>
+ <restconf.version>1.3.0-SNAPSHOT</restconf.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+ <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.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.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-resourcepool-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-impl</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>alto-basic-types-features</artifactId>
+ <classifier>features</classifier>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+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
+-->
+<features name="odl-alto-resourcepool-${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.netconf/features-restconf/${restconf.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.alto.core/alto-basic-types-features/${project.version}/xml/features</repository>
+ <feature name='odl-alto-resourcepool-api' version='${project.version}' description='OpenDaylight :: ALTO :: resourcepool :: api'>
+ <!-- FIXME: Bug 4202: Switch to MD-SAL provided odl-mdsal-models-base -->
+ <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
+ <feature version='${project.version}'>odl-alto-basic-types</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-resourcepool-api/${project.version}</bundle>
+ </feature>
+ <feature name='odl-alto-resourcepool' version='${project.version}' description='OpenDaylight :: ALTO :: resourcepool'>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${project.version}'>odl-alto-resourcepool-api</feature>
+ <bundle>mvn:org.opendaylight.alto.core/alto-resourcepool-impl/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/alto-resourcepool-impl.xml">mvn:org.opendaylight.alto.core/alto-resourcepool-impl/${project.version}/xml/config</configfile>
+ </feature>
+ <feature name='odl-alto-resourcepool-rest' version='${project.version}' description='OpenDaylight :: ALTO :: resourcepool :: REST'>
+ <feature version="${project.version}">odl-alto-resourcepool</feature>
+ <feature version="${restconf.version}">odl-restconf</feature>
+ </feature>
+ <feature name='odl-alto-resourcepool-ui' version='${project.version}' description='OpenDaylight :: ALTO :: resourcepool :: UI'>
+ <feature version="${project.version}">odl-alto-resourcepool-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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+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
+-->
+<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-resourcepool-impl</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-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>
+ </dependencies>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+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
+-->
+<snapshot>
+ <required-capabilities>
+ <capability>urn:opendaylight:alto:core:resourcepool:impl?module=alto-resourcepool-impl&revision=2015-09-21</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&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:resourcepool:impl">prefix:alto-resourcepool-provider</type>
+ <name>alto-resourcepool-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>
+ </data>
+ </configuration>
+</snapshot>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+ <groupId>org.opendaylight.alto.core</groupId>
+ <artifactId>resources-impl</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <localCopy>true</localCopy>
+ </snapshot>
+ <lastUpdated>20150922130129</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <classifier>config</classifier>
+ <extension>xml</extension>
+ <value>1.0.0-SNAPSHOT</value>
+ <updated>20150922130129</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
--- /dev/null
+/*
+ * 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.resourcepool.impl;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.AsyncFunction;
+import com.google.common.util.concurrent.SettableFuture;
+//import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.CheckedFuture;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import java.util.LinkedList;
+//import java.util.List;
+//import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+//import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+
+//import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.AddResourceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.AltoResourcepoolService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.CapabilitySpec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.RemoveResourceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ResourceDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ResourcePool;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ResourcePoolBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.ResourceService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.UpdateResourceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.VerifyResourceInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.Resource;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.ResourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.desc.Dependency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.ResourceKey;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.types.rev150921.ResourceId;
+
+//import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+//import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.opendaylight.alto.core.resourcepool.impl.AltoResourcepoolServiceHelper.ResourceCallback;
+
+public class AltoResourcepoolProvider implements BindingAwareProvider, AutoCloseable, AltoResourcepoolService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AltoResourcepoolProvider.class);
+
+ private InstanceIdentifier<ResourcePool> m_rpIID;
+
+ private DataBroker m_dataBrokerService = null;
+ // TODO private NotificationProviderService notificationService = null;
+
+ private RpcRegistration<AltoResourcepoolService> m_serviceReg = null;
+
+ @Override
+ public void onSessionInitiated(ProviderContext session) {
+ LOG.info("AltoResourcesProvider Session Initiated");
+
+ m_dataBrokerService = session.getSALService(DataBroker.class);
+ m_serviceReg = session.addRpcImplementation(AltoResourcepoolService.class, this);
+ assert m_dataBrokerService != null;
+ assert m_serviceReg != null;
+
+ m_rpIID = InstanceIdentifier.builder(ResourcePool.class).build();
+
+ try {
+ createTopLevelContainers();
+ } catch (Exception e) {
+ LOG.error("Failed to create top-level containers for ALTO services");
+ }
+ }
+
+ protected void createTopLevelContainers()
+ throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+ WriteTransaction wx = m_dataBrokerService.newWriteOnlyTransaction();
+
+ ResourcePool rp;
+
+ rp = new ResourcePoolBuilder().setResource(new LinkedList<Resource>()).build();
+ wx.put(LogicalDatastoreType.OPERATIONAL, m_rpIID, rp);
+
+ wx.submit().get();
+ // Only proceed if the top-level containers are created successfully
+ }
+
+ protected void deleteTopLevelContainers() throws Exception {
+ WriteTransaction wx = m_dataBrokerService.newWriteOnlyTransaction();
+
+ wx.delete(LogicalDatastoreType.OPERATIONAL, m_rpIID);
+
+ wx.submit().get();
+ }
+
+ @Override
+ public void close() throws Exception {
+ try {
+ deleteTopLevelContainers();
+ } catch (Exception e) {
+ /* Exit anyway */
+ }
+ if (m_serviceReg != null) {
+ m_serviceReg.close();
+ }
+ LOG.info("AltoResourcesProvider Closed");
+ }
+
+ protected InstanceIdentifier<Resource> getResourceIID(ResourceId rid) {
+ ResourceKey key = new ResourceKey(rid);
+ return InstanceIdentifier.builder(ResourcePool.class).child(Resource.class, key).build();
+ }
+
+ protected ListenableFuture<RpcResult<Void>> failWithError(String errorMessage) {
+ return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, errorMessage).buildFuture();
+ }
+
+ @Override
+ public Future<RpcResult<Void>> addResource(final AddResourceInput input) {
+ final ReadWriteTransaction rwx = m_dataBrokerService.newReadWriteTransaction();
+
+ final ResourceDesc desc = (ResourceDesc)input;
+ final ResourceService service = (ResourceService)input;
+ return rpcTemplate(rwx, desc, service, new ResourceCallback() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(Optional<Resource> resource) {
+ if (resource.isPresent()) {
+ return failWithError("Adding resource failure: already exists");
+ }
+
+ InstanceIdentifier<Resource> rIID = getResourceIID(desc.getResourceId());
+
+ ResourceBuilder builder = new ResourceBuilder();
+ builder.fieldsFrom(desc);
+ builder.fieldsFrom(service);
+ builder.setRefcount(0);
+ /* TODO setTag() and dynamic tag generation */
+
+ rwx.put(LogicalDatastoreType.OPERATIONAL, rIID, builder.build());
+ CheckedFuture<Void, ? extends Exception> write = rwx.submit();
+
+ try {
+ write.get();
+ return RpcResultBuilder.<Void>success().buildFuture();
+ } catch (Exception e) {
+ return failWithError("Failed to update data store: " + e.getMessage());
+ }
+ }
+ });
+ }
+
+ @Override
+ public Future<RpcResult<Void>> removeResource(RemoveResourceInput input) {
+ //TODO
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<Void>> updateResource(UpdateResourceInput input) {
+ //TODO
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<Void>> verifyResource(final VerifyResourceInput input) {
+ ReadTransaction rx = m_dataBrokerService.newReadOnlyTransaction();
+
+ ListenableFuture<String> message;
+ message = _verifyResource(rx, (ResourceDesc)input, (ResourceService)input);
+
+ Future<RpcResult<Void>> result;
+ result = Futures.transform(message, new AsyncFunction<String, RpcResult<Void>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(String errorMessage) {
+ if (errorMessage != null) {
+ return failWithError("Verification failure: " + errorMessage);
+ }
+ return RpcResultBuilder.<Void>success().buildFuture();
+ }
+ });
+ return result;
+ }
+
+ protected ListenableFuture<RpcResult<Void>> rpcTemplate(final ReadTransaction rx,
+ final ResourceDesc desc,
+ final ResourceService service,
+ final ResourceCallback callback) {
+ ListenableFuture<String> message;
+ message = _verifyResource(rx, desc, service);
+
+ ListenableFuture<RpcResult<Void>> result;
+ result = Futures.transform(message, new AsyncFunction<String, RpcResult<Void>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(String errorMessage) {
+ if (errorMessage != null) {
+ return failWithError("Verification failure: " + errorMessage);
+ }
+
+ InstanceIdentifier<Resource> rIID = getResourceIID(desc.getResourceId());
+ ListenableFuture<Optional<Resource>> resource;
+ resource = rx.read(LogicalDatastoreType.OPERATIONAL, rIID);
+
+ return Futures.transform(resource, callback);
+ }
+ });
+ return result;
+ }
+
+ protected ListenableFuture<String> _verifyResource(ReadTransaction rx,
+ final ResourceDesc desc,
+ final ResourceService service) {
+ ListenableFuture<Optional<ResourcePool>> pool;
+ pool = rx.read(LogicalDatastoreType.OPERATIONAL, m_rpIID);
+
+ ListenableFuture<String> result;
+ result = Futures.transform(pool, new AsyncFunction<Optional<ResourcePool>, String>() {
+ @Override
+ public ListenableFuture<String> apply(Optional<ResourcePool> pool) {
+ String message = null;
+
+ if (!pool.isPresent()) {
+ message = "Failed to read top-level container";
+ } else {
+ ResourcePool rp = pool.get();
+ message = __verifyResource(desc, service, rp);
+ }
+
+ SettableFuture<String> messageFuture = SettableFuture.<String>create();
+ messageFuture.set(message);
+ return messageFuture;
+ }
+ });
+ return result;
+ }
+
+ protected String __verifyResource(ResourceDesc desc, ResourceService service, ResourcePool rp) {
+ if ((desc == null) || (service == null)) {
+ return "Missing desc or service";
+ }
+
+ if (desc.getResourceId() == null) {
+ return "Resource Id must not be null";
+ }
+
+ /* If resource is local, the uri must be provided. Otherwise the uri will be emitted. */
+ if (Boolean.FALSE.equals(desc.isLocal())) {
+ if ((desc.getUri() == null) || (desc.getUri().equals(""))) {
+ return "URI must be provided for remote resourcepool";
+ }
+ }
+
+ if (desc.getType() == null) {
+ return "Type must not be null";
+ }
+ //TODO validate the type
+
+ // TODO Use type validator to validate the capabilities
+ if (desc.getCapability() == null) {
+ }
+
+ if (desc.getCapability() != null) {
+ for (CapabilitySpec spec: desc.getCapability()) {
+ //TODO validate the capability spec
+ }
+ }
+
+ if (desc.getDependency() != null) {
+ Set<ResourceId> available = new HashSet<ResourceId>();
+
+ for (Resource resource: rp.getResource()) {
+ available.add(resource.getResourceId());
+ }
+
+ for (Dependency dependency: desc.getDependency()) {
+ ResourceId rid = dependency.getResourceId();
+ if (!available.contains(rid)) {
+ return "Unresolved dependency: " + rid.getValue();
+ }
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * 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.resourcepool.impl;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.AsyncFunction;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.rev150921.resource.pool.Resource;
+
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+class AltoResourcepoolServiceHelper {
+
+ public static interface VerificationCallback
+ extends AsyncFunction<String, RpcResult<Void>> {
+ }
+
+ public static interface ResourceCallback
+ extends AsyncFunction<Optional<Resource>, RpcResult<Void>> {
+ }
+}
--- /dev/null
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921;
+
+import org.opendaylight.alto.core.resourcepool.impl.AltoResourcepoolProvider;
+
+public class AltoResourcepoolModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921.AbstractAltoResourcepoolModule {
+ public AltoResourcepoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public AltoResourcepoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921.AltoResourcepoolModule 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() {
+ AltoResourcepoolProvider provider = new AltoResourcepoolProvider();
+
+ getBrokerDependency().registerProvider(provider);
+ return provider;
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: alto-resourcepool-impl yang module local name: alto-resourcepool
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Sep 24 14:28:55 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.resourcepool.impl.rev150921;
+public class AltoResourcepoolModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921.AbstractAltoResourcepoolModuleFactory {
+
+}
--- /dev/null
+module alto-resourcepool-impl {
+ yang-version 1;
+
+ namespace "urn:opendaylight:alto:core:resourcepool:impl";
+
+ prefix "alto-resourcepool-impl";
+
+ 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 resources project";
+
+ revision "2015-09-21" {
+ description
+ "Initial revision";
+ }
+
+ identity "alto-resourcepool-provider" {
+ base config:module-type;
+ config:java-name-prefix AltoResourcepool;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case alto-resourcepool {
+ when "/config:modules/config:module/config:type = 'alto-resourcepool-provider'";
+
+ container broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-broker-osgi-registry;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921;
+
+import org.junit.Test;
+
+public class AltoResourcepoolModuleFactoryTest {
+ @Test
+ public void testFactoryConstructor() {
+ // ensure no exceptions on construction
+ new AltoResourcepoolModuleFactory();
+ }
+}
--- /dev/null
+/*
+ * 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
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.alto.core.resourcepool.impl.rev150921;
+
+import org.junit.Test;
+import org.junit.Assert;
+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.resourcepool.impl.AltoResourcepoolProvider;
+
+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 AltoResourcepoolModuleTest {
+ @Test
+ public void testCustomValidation() {
+ AltoResourcepoolModule module = new AltoResourcepoolModule(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
+ AltoResourcepoolModule module = new AltoResourcepoolModule(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((AltoResourcepoolProvider)closeable);
+
+ // ensure no exceptions on close
+ closeable.close();
+ }
+}
--- /dev/null
+<?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
+-->
+
+<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-resourcepool-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-resourcepool-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-resourcepool-features</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+/*
+ * 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
+ */
+package org.opendaylight.alto.core.resourcepool.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 AltoResourcepoolIT extends AbstractMdsalTestBase {
+ private static final Logger LOG = LoggerFactory.getLogger(AltoResourcepoolIT.class);
+
+ @Override
+ public String getModuleName() {
+ return "alto-resourcepool-provider";
+ }
+
+ @Override
+ public String getInstanceName() {
+ return "alto-resourcepool-default";
+ }
+
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven()
+ .groupId("org.opendaylight.alto.core")
+ .artifactId("alto-resourcepool-features")
+ .classifier("features")
+ .type("xml")
+ .versionAsInProject();
+ }
+
+ @Override
+ public String getFeatureName() {
+ return "odl-alto-resourcepool-ui";
+ }
+
+ @Override
+ public Option getLoggingOption() {
+ Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ logConfiguration(AltoResourcepoolIT.class),
+ LogLevel.INFO.name());
+ option = composite(option, super.getLoggingOption());
+ return option;
+ }
+
+ @Test
+ public void testresourcepoolFeatureLoad() {
+ Assert.assertTrue(true);
+ }
+}
--- /dev/null
+<?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.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-resourcepool-karaf</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <karaf.localFeature>odl-alto-resourcepool-ui</karaf.localFeature>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>alto-resourcepool-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-resourcepool-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>
--- /dev/null
+<?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>alto-resourcepool-aggregator</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <name>alto-resourcepool</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>
+ <module>features</module>
+ <module>artifacts</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>alto-test</id>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <module>features</module>
+ <module>artifacts</module>
+ <module>karaf</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>
+</project>
<module>alto-services/provider</module>
<module>alto-extensions</module>
<module>alto-northbound</module>
- <module>alto-karaf</module>
+ <!-- <module>alto-karaf</module> -->
<module>alto-release-features</module>
</modules>