Remove genius/resourcemanager 46/78746/2
authorFaseela K <faseela.k@ericsson.com>
Thu, 13 Dec 2018 10:37:57 +0000 (16:07 +0530)
committerFaseela K <faseela.k@ericsson.com>
Fri, 14 Dec 2018 06:09:07 +0000 (11:39 +0530)
resourcemanager is not used by any applications for
the last few releases. Let us remove it from the
main genius feature, and add it back only when
someone really needs it.

Change-Id: I3e381cc3b401bca94a1084469d45c643cfad5f47
Signed-off-by: Faseela K <faseela.k@ericsson.com>
13 files changed:
features/odl-genius-api/pom.xml
features/odl-genius/pom.xml
pom.xml
resourcemanager/pom.xml [deleted file]
resourcemanager/resourcemanager-api/pom.xml [deleted file]
resourcemanager/resourcemanager-api/src/main/yang/resource-manager.yang [deleted file]
resourcemanager/resourcemanager-impl/pom.xml [deleted file]
resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManager.java [deleted file]
resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManagerUtils.java [deleted file]
resourcemanager/resourcemanager-impl/src/main/resources/OSGI-INF/blueprint/resourcemanager.xml [deleted file]
resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTest.java [deleted file]
resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTestModule.java [deleted file]
resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/package-info.java [deleted file]

index 67154b80b8b139280bcfee930084481d493c93f8..18f17fa7ca47343054c7328317f54bf4d41197cd 100644 (file)
       <artifactId>itm-api</artifactId>
       <version>${project.version}</version>
     </dependency>
       <artifactId>itm-api</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>resourcemanager-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.genius</groupId>
       <artifactId>ipv6util-api</artifactId>
     <dependency>
       <groupId>org.opendaylight.genius</groupId>
       <artifactId>ipv6util-api</artifactId>
index 8ff963c0ee9adec049a7073c03d8d8821dc214e4..6cb20ba52d6b4282c396662b9d37efcca4e65140 100644 (file)
       <artifactId>itm-impl</artifactId>
       <version>${project.version}</version>
     </dependency>
       <artifactId>itm-impl</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>resourcemanager-impl</artifactId>
-      <version>${project.version}</version>
-    </dependency>
     <dependency>
       <!-- finalname="etc/opendaylight/datastore/initial/config/genius-itm-config.xml" -->
       <groupId>org.opendaylight.genius</groupId>
     <dependency>
       <!-- finalname="etc/opendaylight/datastore/initial/config/genius-itm-config.xml" -->
       <groupId>org.opendaylight.genius</groupId>
diff --git a/pom.xml b/pom.xml
index afff235aef1d458cdeceb6ebc1289f84e9885139..35a08dc6753513deed1561ce4e93b95fb98cc59d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL -->
     <module>artifacts</module>
     <module>fcapsmanager</module>
     <module>fcapsapplication</module>
     <module>artifacts</module>
     <module>fcapsmanager</module>
     <module>fcapsapplication</module>
-    <module>resourcemanager</module>
     <module>ipv6util</module>
   </modules>
 
     <module>ipv6util</module>
   </modules>
 
diff --git a/resourcemanager/pom.xml b/resourcemanager/pom.xml
deleted file mode 100644 (file)
index 57e516e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>odlparent-lite</artifactId>
-    <version>4.0.2</version>
-    <relativePath/>
-  </parent>
-
-  <groupId>org.opendaylight.genius</groupId>
-  <artifactId>resourcemanager-aggregator</artifactId>
-  <version>0.6.0-SNAPSHOT</version>
-  <!-- <name> formatting is used by autorelease to parse and notify projects on
-       build failure. Please do not modify this unless you have a good reason. -->
-  <name>ODL :: genius :: ${project.artifactId}</name>
-  <packaging>pom</packaging>
-
-  <modules>
-    <module>resourcemanager-api</module>
-    <module>resourcemanager-impl</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>
diff --git a/resourcemanager/resourcemanager-api/pom.xml b/resourcemanager/resourcemanager-api/pom.xml
deleted file mode 100644 (file)
index 34c6809..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright © 2016 Ericsson India Global Services Pvt Ltd. 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>
-
-  <parent>
-    <groupId>org.opendaylight.genius</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.6.0-SNAPSHOT</version>
-    <relativePath>../../commons/binding-parent</relativePath>
-  </parent>
-
-  <groupId>org.opendaylight.genius</groupId>
-  <artifactId>resourcemanager-api</artifactId>
-  <version>0.6.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
-  <!-- <name> formatting is used by autorelease to parse and notify projects on
-       build failure. Please do not modify this unless you have a good reason. -->
-  <name>ODL :: genius :: ${project.artifactId}</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>yang-binding</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>yang-common</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>idmanager-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/resourcemanager/resourcemanager-api/src/main/yang/resource-manager.yang b/resourcemanager/resourcemanager-api/src/main/yang/resource-manager.yang
deleted file mode 100644 (file)
index 157e45a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-module resource-manager {
-    namespace "urn:opendaylight:genius:resourcemanager";
-    prefix resourcemgr;
-
-    import id-manager {
-        prefix idmgr;
-    }
-
-    revision "2016-06-22" {
-        description "YANG model exposes RPCs that can be used by the applications for allocating a block of IDs for tables, groups, meters, etc. This yang-model enables ODL Resource Sharing Framework";
-    }
-
-
-    identity resource-type-base {
-        description "Base identity for all resource-types";
-    }
-
-    identity resource-type-table-ids {
-        description "Resource type for tables";
-        base resource-type-base;
-    }
-
-    identity resource-type-group-ids {
-        description "Resource type for groups";
-        base resource-type-base;
-    }
-
-    identity resource-type-meter-ids {
-        description "Resource type for meters";
-        base resource-type-base;
-    }
-
-    rpc releaseResource {
-        input {
-             leaf resource-type {
-                type identityref{
-                    base resource-type-base;
-                }
-             }
-             leaf id-key {
-                type string;
-             }
-        }
-    }
-
-    rpc allocateResource {
-        input {
-             leaf resource-type {
-                type identityref{
-                    base resource-type-base;
-                }
-             }
-             leaf id-key {
-                type string;
-             }
-             leaf size {
-                type uint32;
-             }
-        }
-        output {
-             leaf-list id-values{
-                type uint32;
-                ordered-by user;
-             }
-        }
-    }
-
-    rpc getAvailableResources{
-        input {
-             leaf resource-type {
-                type identityref{
-                    base resource-type-base;
-                }
-             }
-        }
-        output{
-             leaf total-available-id-count {
-                type uint32;
-             }
-        }
-    }
-
-    rpc getResourcePool{
-        input{
-             leaf resource-type {
-                type identityref{
-                    base resource-type-base;
-                }
-             }
-        }
-        output{
-             list available-ids{
-                uses available-resource-ids;
-             }
-             uses released-resource-ids;
-        }
-    }
-
-    grouping available-resource-ids {
-        leaf start {
-             type uint32;
-        }
-        leaf end {
-             type uint32;
-        }
-    }
-
-    grouping released-resource-ids {
-        list delayed-resource-entries {
-            uses idmgr:delayed-id-entry;
-        }
-    }
-}
diff --git a/resourcemanager/resourcemanager-impl/pom.xml b/resourcemanager/resourcemanager-impl/pom.xml
deleted file mode 100644 (file)
index aef0dd8..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright © 2016 Ericsson India Global Services Pvt Ltd. 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>
-
-  <parent>
-    <groupId>org.opendaylight.genius</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.6.0-SNAPSHOT</version>
-    <relativePath>../../commons/binding-parent</relativePath>
-  </parent>
-
-  <groupId>org.opendaylight.genius</groupId>
-  <artifactId>resourcemanager-impl</artifactId>
-  <packaging>bundle</packaging>
-  <!-- <name> formatting is used by autorelease to parse and notify projects on
-       build failure. Please do not modify this unless you have a good reason. -->
-  <name>ODL :: genius :: ${project.artifactId}</name>
-
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.genius</groupId>
-        <artifactId>genius-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>resourcemanager-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>idmanager-api</artifactId>
-        <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>mdsalutil-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-    </dependency>
-
-    <!-- Testing Dependencies -->
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>lockmanager-impl</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>idmanager-impl</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>testutils</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.genius</groupId>
-      <artifactId>mdsalutil-testutils</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <dependencies>
-            <dependency>
-              <groupId>org.opendaylight.genius</groupId>
-              <artifactId>checkstyle</artifactId>
-              <version>${project.version}</version>
-            </dependency>
-          </dependencies>
-          <executions>
-            <execution>
-              <id>check-databroker</id>
-              <goals>
-                <goal>check</goal>
-              </goals>
-              <phase>process-sources</phase>
-              <configuration>
-                <configLocation>databroker-checks.xml</configLocation>
-                <includeResources>false</includeResources>
-                <includeTestSourceDirectory>false</includeTestSourceDirectory>
-                <includeTestResources>false</includeTestResources>
-                <sourceDirectories>
-                  <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
-                </sourceDirectories>
-                <failsOnError>true</failsOnError>
-                <consoleOutput>true</consoleOutput>
-              </configuration>
-            </execution>
-          </executions>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.aries.blueprint</groupId>
-        <artifactId>blueprint-maven-plugin</artifactId>
-      </plugin>
-    </plugins>
-  </build>
-</project>
diff --git a/resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManager.java b/resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManager.java
deleted file mode 100644 (file)
index c0a1b8d..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.genius.resourcemanager;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdRangeInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdRangeOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.id.pool.AvailableIdsHolder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.id.pool.ReleasedIdsHolder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.released.ids.DelayedIdEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeGroupIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeMeterIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeTableIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.getresourcepool.output.AvailableIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.getresourcepool.output.AvailableIdsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.released.resource.ids.DelayedResourceEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.released.resource.ids.DelayedResourceEntriesBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Singleton
-public class ResourceManager implements ResourceManagerService, AutoCloseable {
-    // Property names
-    private static final String RESOURCE_TABLES_NAME_PROPERTY = "resource.tables.name";
-    private static final String RESOURCE_GROUPS_NAME_PROPERTY = "resource.groups.name";
-    private static final String RESOURCE_METERS_NAME_PROPERTY = "resource.meters.name";
-
-    private static final String RESOURCE_TABLES_START_ID_PROPERTY = "resource.tables.startId";
-    private static final String RESOURCE_TABLES_END_ID_PROPERTY = "resource.tables.endId";
-    private static final String RESOURCE_GROUPS_START_ID_PROPERTY = "resource.groups.startId";
-    private static final String RESOURCE_GROUPS_END_ID_PROPERTY = "resource.groups.endId";
-    private static final String RESOURCE_METERS_START_ID_PROPERTY = "resource.meters.startId";
-    private static final String RESOURCE_METERS_END_ID_PROPERTY = "resource.meters.endId";
-
-    // Cache default values
-    private static final String RESOURCE_TABLES_DEFAULT_NAME = "tables";
-    private static final String RESOURCE_GROUPS_DEFAULT_NAME = "groups";
-    private static final String RESOURCE_METERS_DEFAULT_NAME = "meters";
-
-    // Default ranges of IDs
-    private static final String DEFAULT_LOW_RANGE = "0";
-    private static final String DEFAULT_HIGH_RANGE = "254";
-
-    // Messages
-    private static final String RESOURCE_TYPE_CANNOT_BE_NULL = "Resource type cannot be null";
-    private static final String RESOURCE_TYPE_NOT_FOUND = "Resource type not found";
-    private static final String RESOURCE_ID_CANNOT_BE_NULL = "Id key cannot be null";
-    private static final String RESOURCE_SIZE_CANNOT_BE_NULL = "Resource size cannot be null";
-
-    // Other services
-    private final DataBroker dataBroker;
-    private final IdManagerService idManager;
-
-    // Cache of resources
-    private final ConcurrentMap<Class<? extends ResourceTypeBase>, String> resourcesCache;
-
-    private static final Logger LOG = LoggerFactory.getLogger(ResourceManager.class);
-
-    @Inject
-    public ResourceManager(final DataBroker dataBroker, final IdManagerService idManager) {
-        this.dataBroker = dataBroker;
-        this.idManager = idManager;
-        this.resourcesCache = loadCache();
-        createIdpools();
-    }
-
-    private ConcurrentMap<Class<? extends ResourceTypeBase>, String> loadCache() {
-        ConcurrentMap<Class<? extends ResourceTypeBase>, String> cache = new ConcurrentHashMap<>();
-        cache.put(ResourceTypeTableIds.class,
-                System.getProperty(RESOURCE_TABLES_NAME_PROPERTY, RESOURCE_TABLES_DEFAULT_NAME));
-        cache.put(ResourceTypeGroupIds.class,
-                System.getProperty(RESOURCE_GROUPS_NAME_PROPERTY, RESOURCE_GROUPS_DEFAULT_NAME));
-        cache.put(ResourceTypeMeterIds.class,
-                System.getProperty(RESOURCE_METERS_NAME_PROPERTY, RESOURCE_METERS_DEFAULT_NAME));
-        return cache;
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<AllocateResourceOutput>> allocateResource(AllocateResourceInput input) {
-        Objects.requireNonNull(input.getResourceType(), RESOURCE_TYPE_CANNOT_BE_NULL);
-        Objects.requireNonNull(input.getIdKey(), RESOURCE_ID_CANNOT_BE_NULL);
-        Objects.requireNonNull(input.getSize(), RESOURCE_SIZE_CANNOT_BE_NULL);
-
-        Objects.requireNonNull(resourcesCache.get(input.getResourceType()), RESOURCE_TYPE_NOT_FOUND);
-
-        AllocateIdRangeInputBuilder allocateIdRangeBuilder = new AllocateIdRangeInputBuilder();
-        allocateIdRangeBuilder.setIdKey(input.getIdKey()).setPoolName(resourcesCache.get(input.getResourceType()))
-                .setSize(input.getSize());
-        Future<RpcResult<AllocateIdRangeOutput>> output = idManager.allocateIdRange(allocateIdRangeBuilder.build());
-        AllocateResourceOutputBuilder allocateResourceOutputBuilder = new AllocateResourceOutputBuilder();
-        RpcResultBuilder<AllocateResourceOutput> allocateResourceOutputRpcBuilder = null;
-        try {
-            if (output.get().isSuccessful()) {
-                AllocateIdRangeOutput allocateIdRangeOutput = output.get().getResult();
-                List<Long> idValues = allocateIdRangeOutput.getIdValues();
-                allocateResourceOutputBuilder.setIdValues(idValues);
-                allocateResourceOutputRpcBuilder = RpcResultBuilder.success();
-                allocateResourceOutputRpcBuilder.withResult(allocateResourceOutputBuilder.build());
-            }
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Allocate Resource failed for resource {} due to ", input.getResourceType(), e);
-            allocateResourceOutputRpcBuilder = RpcResultBuilder.failed();
-            allocateResourceOutputRpcBuilder.withError(RpcError.ErrorType.APPLICATION, e.getMessage());
-        }
-
-        if (allocateResourceOutputRpcBuilder == null) {
-            allocateResourceOutputRpcBuilder = RpcResultBuilder.failed();
-            allocateResourceOutputRpcBuilder.withError(RpcError.ErrorType.APPLICATION, "Resource cannot be  allocated");
-        }
-        return Futures.immediateFuture(allocateResourceOutputRpcBuilder.build());
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<GetResourcePoolOutput>> getResourcePool(GetResourcePoolInput input) {
-        Objects.requireNonNull(input.getResourceType(), RESOURCE_TYPE_CANNOT_BE_NULL);
-        Objects.requireNonNull(resourcesCache.get(input.getResourceType()), RESOURCE_TYPE_CANNOT_BE_NULL);
-
-        long currentTimeSec = System.currentTimeMillis() / 1000;
-        List<AvailableIds> availableIdsList = new ArrayList<>();
-        List<DelayedResourceEntries> delayedIdEntriesList = new ArrayList<>();
-        InstanceIdentifier<IdPool> parentId = ResourceManagerUtils
-                .getIdPoolInstance(resourcesCache.get(input.getResourceType()));
-        Optional<IdPool> optionalParentIdPool = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, parentId,
-                dataBroker);
-        if (optionalParentIdPool != null && optionalParentIdPool.isPresent()) {
-            IdPool parentIdPool = optionalParentIdPool.get();
-            AvailableIdsHolder availableParentIdsHolder = parentIdPool.getAvailableIdsHolder();
-            if (availableParentIdsHolder.getStart() < availableParentIdsHolder.getEnd()) {
-                availableIdsList.add(new AvailableIdsBuilder().setStart(availableParentIdsHolder.getStart())
-                        .setEnd(availableParentIdsHolder.getEnd()).build());
-            }
-            ReleasedIdsHolder releasedParentIdsHolder = parentIdPool.getReleasedIdsHolder();
-            if (releasedParentIdsHolder != null) {
-                List<DelayedIdEntries> delayedIdParentList = releasedParentIdsHolder.getDelayedIdEntries();
-                if (delayedIdParentList != null && !delayedIdParentList.isEmpty()) {
-                    for (DelayedIdEntries delayedParentEntry : delayedIdParentList) {
-                        delayedIdEntriesList.add(new DelayedResourceEntriesBuilder().setId(delayedParentEntry.getId())
-                                .setReadyTimeSec(delayedParentEntry.getReadyTimeSec()).build());
-                    }
-                }
-            }
-        }
-
-        String localPool = ResourceManagerUtils.getLocalPoolName(resourcesCache.get(input.getResourceType()));
-        InstanceIdentifier<IdPool> localId = ResourceManagerUtils.getIdPoolInstance(localPool);
-        Optional<IdPool> optionalLocalId = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, localId, dataBroker);
-        if (optionalLocalId != null && optionalLocalId.isPresent()) {
-            IdPool localIdPool = optionalLocalId.get();
-            AvailableIdsHolder availableLocalIdsHolder = localIdPool.getAvailableIdsHolder();
-            if (availableLocalIdsHolder != null
-                    && availableLocalIdsHolder.getStart() < availableLocalIdsHolder.getEnd()) {
-                availableIdsList.add(new AvailableIdsBuilder().setStart(availableLocalIdsHolder.getStart())
-                        .setEnd(availableLocalIdsHolder.getEnd()).build());
-            }
-            ReleasedIdsHolder releasedLocalIdsHolder = localIdPool.getReleasedIdsHolder();
-            if (releasedLocalIdsHolder != null) {
-                List<DelayedIdEntries> delayedIdLocalList = releasedLocalIdsHolder.getDelayedIdEntries();
-                if (delayedIdLocalList != null && !delayedIdLocalList.isEmpty()) {
-                    for (DelayedIdEntries delayedLocalEntry : delayedIdLocalList) {
-                        if (delayedLocalEntry.getReadyTimeSec() > currentTimeSec) {
-                            break;
-                        }
-                        delayedIdEntriesList.add(new DelayedResourceEntriesBuilder().setId(delayedLocalEntry.getId())
-                                .setReadyTimeSec(delayedLocalEntry.getReadyTimeSec()).build());
-                    }
-                }
-            }
-        }
-        GetResourcePoolOutput output = new GetResourcePoolOutputBuilder().setAvailableIds(availableIdsList)
-                .setDelayedResourceEntries(delayedIdEntriesList).build();
-        return RpcResultBuilder.success(output).buildFuture();
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<GetAvailableResourcesOutput>> getAvailableResources(
-            GetAvailableResourcesInput input) {
-        Objects.requireNonNull(input.getResourceType(), RESOURCE_TYPE_CANNOT_BE_NULL);
-        Objects.requireNonNull(resourcesCache.get(input.getResourceType()), RESOURCE_TYPE_NOT_FOUND);
-
-        long totalIdsAvailableForAllocation = 0;
-        long currentTimeSec = System.currentTimeMillis() / 1000;
-        InstanceIdentifier<IdPool> parentId = ResourceManagerUtils
-                .getIdPoolInstance(resourcesCache.get(input.getResourceType()));
-        Optional<IdPool> optionalParentIdPool = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, parentId,
-                dataBroker);
-        if (optionalParentIdPool != null && optionalParentIdPool.isPresent()) {
-            IdPool parentIdPool = optionalParentIdPool.get();
-            AvailableIdsHolder availableParentIdsHolder = parentIdPool.getAvailableIdsHolder();
-            totalIdsAvailableForAllocation = availableParentIdsHolder.getEnd() - availableParentIdsHolder.getCursor();
-            ReleasedIdsHolder releasedParentIdsHolder = parentIdPool.getReleasedIdsHolder();
-            if (releasedParentIdsHolder != null) {
-                List<DelayedIdEntries> delayedIdParentList = releasedParentIdsHolder.getDelayedIdEntries();
-                if (delayedIdParentList != null && !delayedIdParentList.isEmpty()) {
-                    totalIdsAvailableForAllocation += delayedIdParentList.size();
-                }
-            }
-        }
-
-        String localPool = ResourceManagerUtils.getLocalPoolName(resourcesCache.get(input.getResourceType()));
-        InstanceIdentifier<IdPool> localId = ResourceManagerUtils.getIdPoolInstance(localPool);
-        Optional<IdPool> optionalLocalId = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, localId, dataBroker);
-        if (optionalLocalId != null && optionalLocalId.isPresent()) {
-            IdPool localIdPool = optionalLocalId.get();
-            AvailableIdsHolder availableLocalIdsHolder = localIdPool.getAvailableIdsHolder();
-            if (availableLocalIdsHolder != null) {
-                totalIdsAvailableForAllocation += availableLocalIdsHolder.getEnd()
-                        - availableLocalIdsHolder.getCursor();
-            }
-            ReleasedIdsHolder releasedLocalIdsHolder = localIdPool.getReleasedIdsHolder();
-            if (releasedLocalIdsHolder != null) {
-                long count = 0;
-                List<DelayedIdEntries> delayedIdLocalList = releasedLocalIdsHolder.getDelayedIdEntries();
-                if (delayedIdLocalList != null && !delayedIdLocalList.isEmpty()) {
-                    for (DelayedIdEntries delayedLocalEntry : delayedIdLocalList) {
-                        if (delayedLocalEntry.getReadyTimeSec() > currentTimeSec) {
-                            break;
-                        }
-                    }
-                    count++;
-                }
-                totalIdsAvailableForAllocation += count;
-            }
-        }
-
-        GetAvailableResourcesOutputBuilder outputBuilder = new GetAvailableResourcesOutputBuilder()
-                .setTotalAvailableIdCount(totalIdsAvailableForAllocation);
-        RpcResultBuilder<GetAvailableResourcesOutput> rpcOutputBuilder = null;
-        rpcOutputBuilder = RpcResultBuilder.success();
-        rpcOutputBuilder.withResult(outputBuilder.build());
-
-        return Futures.immediateFuture(rpcOutputBuilder.build());
-    }
-
-    @Override
-    public ListenableFuture<RpcResult<ReleaseResourceOutput>> releaseResource(ReleaseResourceInput input) {
-        Objects.requireNonNull(input.getIdKey(), RESOURCE_ID_CANNOT_BE_NULL);
-        Objects.requireNonNull(input.getResourceType(), RESOURCE_TYPE_CANNOT_BE_NULL);
-
-        Objects.requireNonNull(resourcesCache.get(input.getResourceType()), RESOURCE_TYPE_NOT_FOUND);
-
-        ReleaseIdInputBuilder releaseIdInputBuilder = new ReleaseIdInputBuilder();
-        releaseIdInputBuilder.setIdKey(input.getIdKey()).setPoolName(resourcesCache.get(input.getResourceType()));
-
-        return transform(idManager.releaseId(releaseIdInputBuilder.build()));
-    }
-
-    private ListenableFuture<RpcResult<ReleaseResourceOutput>> transform(
-            final ListenableFuture<RpcResult<ReleaseIdOutput>> rpcResultListenableFuture) {
-        return Futures.transform(rpcResultListenableFuture, input -> {
-            final RpcResult<ReleaseResourceOutput> rpcOutput;
-            if (input.isSuccessful()) {
-                final ReleaseResourceOutput sendEchoOutput = new ReleaseResourceOutputBuilder().build();
-                rpcOutput = RpcResultBuilder.success(sendEchoOutput).build();
-            } else {
-                rpcOutput = RpcResultBuilder.<ReleaseResourceOutput>failed()
-                        .withRpcErrors(input.getErrors())
-                        .build();
-            }
-            return rpcOutput;
-        }, MoreExecutors.directExecutor());
-    }
-
-    private void createIdPool(String poolNameProperty, String lowIdProperty, String highIdProperty,
-            String poolDefaultName) {
-        JdkFutures.addErrorLogging(idManager.createIdPool(
-                new CreateIdPoolInputBuilder().setPoolName(System.getProperty(poolNameProperty, poolDefaultName))
-                        .setLow(Long.valueOf(System.getProperty(lowIdProperty, DEFAULT_LOW_RANGE)))
-                        .setHigh(Long.valueOf(System.getProperty(highIdProperty, DEFAULT_HIGH_RANGE))).build()),
-                LOG, "createIdPool");
-    }
-
-    private void createIdpools() {
-        // Create Tables Id Pool
-        createIdPool(RESOURCE_TABLES_NAME_PROPERTY, RESOURCE_TABLES_START_ID_PROPERTY, RESOURCE_TABLES_END_ID_PROPERTY,
-                RESOURCE_TABLES_DEFAULT_NAME);
-
-        // Create Groups Id Pool
-        createIdPool(RESOURCE_GROUPS_NAME_PROPERTY, RESOURCE_GROUPS_START_ID_PROPERTY, RESOURCE_GROUPS_END_ID_PROPERTY,
-                RESOURCE_GROUPS_DEFAULT_NAME);
-
-        // Create Meters Id Pool
-        createIdPool(RESOURCE_METERS_NAME_PROPERTY, RESOURCE_METERS_START_ID_PROPERTY, RESOURCE_METERS_END_ID_PROPERTY,
-                RESOURCE_METERS_DEFAULT_NAME);
-    }
-
-    @Override
-    @PreDestroy
-    public void close() {
-        LOG.debug("{} close", getClass().getSimpleName());
-    }
-}
diff --git a/resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManagerUtils.java b/resourcemanager/resourcemanager-impl/src/main/java/org/opendaylight/genius/resourcemanager/ResourceManagerUtils.java
deleted file mode 100644 (file)
index b218538..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.genius.resourcemanager;
-
-import com.google.common.net.InetAddresses;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdPools;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class ResourceManagerUtils {
-    private static final Logger LOG = LoggerFactory.getLogger(ResourceManagerUtils.class);
-
-    private static int localHostAddress;
-
-    static {
-        try {
-            localHostAddress = InetAddresses.coerceToInteger(InetAddress.getLocalHost());
-        } catch (UnknownHostException e) {
-            LOG.error("Cannot build the local pool name: ", e);
-        }
-    }
-
-    private ResourceManagerUtils() {
-    }
-
-    protected static InstanceIdentifier<IdPool> getIdPoolInstance(String poolName) {
-        InstanceIdentifier.InstanceIdentifierBuilder<IdPool> idPoolBuilder = InstanceIdentifier.builder(IdPools.class)
-                .child(IdPool.class, new IdPoolKey(poolName));
-        return idPoolBuilder.build();
-    }
-
-    protected static String getLocalPoolName(String poolName) {
-        return poolName + "." + localHostAddress;
-    }
-}
diff --git a/resourcemanager/resourcemanager-impl/src/main/resources/OSGI-INF/blueprint/resourcemanager.xml b/resourcemanager/resourcemanager-impl/src/main/resources/OSGI-INF/blueprint/resourcemanager.xml
deleted file mode 100644 (file)
index 455602b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2016 Ericsson Spain, SA. 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
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           odl:use-default-for-reference-types="true">
-
-  <reference id="dataBroker"
-             interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
-             odl:type="default" />
-
-  <odl:rpc-service id="idManagerService"
-                   interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService" />
-
-  <odl:rpc-implementation ref="resourceManager" />
-
-</blueprint>
diff --git a/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTest.java b/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTest.java
deleted file mode 100644 (file)
index 470ba4f..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2017 Ericsson Spain, S.A. 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.genius.resourcemanager.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
-import javax.inject.Inject;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.MethodRule;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
-import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
-import org.opendaylight.infrautils.testutils.LogRule;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.AllocateResourceOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetAvailableResourcesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.GetResourcePoolOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ReleaseResourceOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeGroupIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeMeterIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceTypeTableIds;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-/**
- * Resource Manager Service Test Suite.
- *
- * @author David Suárez
- */
-public class ResourceManagerTest extends AbstractConcurrentDataBrokerTest {
-
-    public final @Rule LogRule logRule = new LogRule();
-    // TODO un-comment after https://bugs.opendaylight.org/show_bug.cgi?id=9204 (and use of it in ResourceManager)
-    // public final @Rule LogCaptureRule logCaptureRule = new LogCaptureRule();
-
-    public final @Rule MethodRule guice = new GuiceRule(
-            ResourceManagerTestModule.class, JobCoordinatorTestModule.class);
-
-    @Inject DataBroker dataBroker;
-    @Inject ResourceManagerService resourceManager;
-
-    private static final Long NUMBER_OF_RESOURCES = 5L;
-
-    @SuppressWarnings("serial")
-    private static final Map<String, Class<? extends ResourceTypeBase>>
-        RESOURCE_TYPES = new HashMap<String, Class<? extends ResourceTypeBase>>() {
-                {
-                    put("Tables", ResourceTypeTableIds.class);
-                    put("Meters", ResourceTypeMeterIds.class);
-                    put("Groups", ResourceTypeGroupIds.class);
-                }
-        };
-
-    @Test
-    public void testGetAvailableResources() throws Exception {
-        for (Class<? extends ResourceTypeBase> resourceType : RESOURCE_TYPES.values()) {
-            RpcResult<GetAvailableResourcesOutput> result = getAvailableResources(resourceType).get();
-            assertSuccessfulFutureRpcResult(result);
-            assertEquals(255L, result.getResult().getTotalAvailableIdCount().longValue());
-        }
-    }
-
-    private Future<RpcResult<GetAvailableResourcesOutput>> getAvailableResources(
-            Class<? extends ResourceTypeBase> resourceType)
-            throws Exception {
-        final GetAvailableResourcesInput input = new GetAvailableResourcesInputBuilder().setResourceType(resourceType)
-                .build();
-        return resourceManager.getAvailableResources(input);
-    }
-
-    @Test
-    public void testGetResourcePools() throws Exception {
-        for (Class<? extends ResourceTypeBase> resourceType : RESOURCE_TYPES.values()) {
-            RpcResult<GetResourcePoolOutput> result = getResourcePool(resourceType).get();
-            assertSuccessfulFutureRpcResult(result);
-            for (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.getresourcepool.output
-                     .AvailableIds availableIds : result.getResult().getAvailableIds()) {
-                assertTrue(availableIds.getStart() < availableIds.getEnd());
-            }
-            assertTrue(result.getResult().getDelayedResourceEntries().isEmpty());
-        }
-    }
-
-    private Future<RpcResult<GetResourcePoolOutput>> getResourcePool(Class<? extends ResourceTypeBase> resourceType)
-            throws Exception {
-        final GetResourcePoolInput input = new GetResourcePoolInputBuilder().setResourceType(resourceType).build();
-        return resourceManager.getResourcePool(input);
-    }
-
-    @Test
-    public void testAllocateResource() throws Exception {
-        for (Class<? extends ResourceTypeBase> resourceType : RESOURCE_TYPES.values()) {
-            // Allocate resources
-            RpcResult<AllocateResourceOutput> result = allocateResource(resourceType.getName(), resourceType,
-                    NUMBER_OF_RESOURCES).get();
-            assertSuccessfulFutureRpcResult(result);
-            assertEquals(NUMBER_OF_RESOURCES, Long.valueOf(result.getResult().getIdValues().size()));
-
-            // Release resources
-            releaseResource(resourceType.getName(), resourceType);
-        }
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testAllocateNullResource() throws Exception {
-        allocateResource(null, ResourceTypeTableIds.class, NUMBER_OF_RESOURCES).get();
-    }
-
-    private Future<RpcResult<AllocateResourceOutput>> allocateResource(String resourceKey,
-            Class<? extends ResourceTypeBase> resourceType,
-            Long numberOfResources) throws Exception {
-        final AllocateResourceInput input = new AllocateResourceInputBuilder().setResourceType(resourceType)
-                .setSize(numberOfResources).setIdKey(resourceKey).setSize(numberOfResources).build();
-        return resourceManager.allocateResource(input);
-    }
-
-    @Test
-    public void testReleaseResource() throws Exception {
-        for (Class<? extends ResourceTypeBase> resourceType : RESOURCE_TYPES.values()) {
-            // Allocate resources
-            allocateResource(resourceType.getName(), resourceType, NUMBER_OF_RESOURCES);
-
-            // Release resources
-            RpcResult<ReleaseResourceOutput> result = releaseResource(resourceType.getName(), resourceType).get();
-            assertSuccessfulFutureRpcResult(result);
-        }
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testReleaseNullResource() throws Exception {
-        releaseResource(null, ResourceTypeTableIds.class).get();
-    }
-
-    private ListenableFuture<RpcResult<ReleaseResourceOutput>> releaseResource(String resourceKey,
-            Class<? extends ResourceTypeBase> resourceType) throws Exception {
-        final ReleaseResourceInput input = new ReleaseResourceInputBuilder().setResourceType(resourceType)
-                .setIdKey(resourceKey).build();
-        return resourceManager.releaseResource(input);
-    }
-
-    private void assertSuccessfulFutureRpcResult(RpcResult<?> result)
-            throws InterruptedException, ExecutionException, TimeoutException {
-        assertTrue(result.isSuccessful());
-        assertTrue(result.getErrors().isEmpty());
-    }
-}
diff --git a/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTestModule.java b/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/ResourceManagerTestModule.java
deleted file mode 100644 (file)
index ef47d4c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017 Ericsson Spain, S.A. 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.genius.resourcemanager.tests;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
-import org.opendaylight.daexim.DataImportBootReady;
-import org.opendaylight.genius.idmanager.IdManager;
-import org.opendaylight.genius.lockmanager.impl.LockListener;
-import org.opendaylight.genius.lockmanager.impl.LockManagerServiceImpl;
-import org.opendaylight.genius.resourcemanager.ResourceManager;
-import org.opendaylight.infrautils.inject.guice.testutils.AbstractGuiceJsr250Module;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.resourcemanager.rev160622.ResourceManagerService;
-
-/**
- * Dependency Injection Wiring for {@link ResourceManagerTest}.
- *
- * <p>
- * For other *Module examples, please see the AclServiceModule and
- * AclServiceTestModule or ElanServiceTestModule instead.
- *
- * @author David Suárez
- */
-public class ResourceManagerTestModule extends AbstractGuiceJsr250Module {
-
-    @Override
-    protected void configureBindings() throws Exception {
-        DataBroker dataBroker = DataBrokerTestModule.dataBroker();
-        bind(DataBroker.class).toInstance(dataBroker);
-
-        bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {});
-
-        bind(LockManagerService.class).to(LockManagerServiceImpl.class);
-        bind(LockListener.class);
-
-        bind(IdManagerService.class).to(IdManager.class);
-        bind(ResourceManagerService.class).to(ResourceManager.class);
-    }
-}
diff --git a/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/package-info.java b/resourcemanager/resourcemanager-impl/src/test/java/org/opendaylight/genius/resourcemanager/tests/package-info.java
deleted file mode 100644 (file)
index cfa2259..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2017 Ericsson Spain, S.A. 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
- */
-/**
- * This package contains component and unit tests for the Resource Manager service.
- *
- * @author David Suárez
- */
-package org.opendaylight.genius.resourcemanager.tests;