Search in sources :

Example 1 with PoolPreferenceLevel

use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.

the class PoolSelectionUnitTest method testSelectForP2PIPv6.

/*
     * test case: check that we do not select read-only pools as p2p
     * destinations.
     */
@Test
public void testSelectForP2PIPv6() throws CommandException {
    _ci.command("psu set allpoolsactive on");
    _ci.command("psu set pool h1-read rdonly");
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = // operation
    _psu.match(// operation
    DirectionType.P2P, // net unit
    "2001:638:700::f00:ba", // protocol
    null, fileAttributes, // linkGroup
    null, defaultExclude);
    List<String> pools = new ArrayList<>();
    for (PoolPreferenceLevel level : preference) {
        pools.addAll(level.getPoolList());
    }
    assertEquals("More than expected pools selected", 1, pools.size());
    assertEquals("Unexpected pool selected", "default-read", pools.get(0));
}
Also used : PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) ArrayList(java.util.ArrayList) FileAttributes(org.dcache.vehicles.FileAttributes) Test(org.junit.Test)

Example 2 with PoolPreferenceLevel

use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.

the class PoolSelectionUnitTest method testAllPoolsOfflineIPv6.

/*
     * test case: check that if all pools is ofline, no pools returned
     */
@Test
public void testAllPoolsOfflineIPv6() throws CommandException {
    _ci.command("psu set allpoolsactive off");
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("*", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = _psu.match(// operation
    DirectionType.READ, // net unit
    "2001:638:700::f00:ba", // protocol
    null, fileAttributes, // linkGroup
    null, defaultExclude);
    int found = 0;
    for (PoolPreferenceLevel level : preference) {
        found += level.getPoolList().size();
    }
    assertEquals(0, found);
}
Also used : PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) FileAttributes(org.dcache.vehicles.FileAttributes) Test(org.junit.Test)

Example 3 with PoolPreferenceLevel

use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.

the class PoolSelectionUnitTest method testSelectPoolByLinkGroup.

/*

      @Test
      public void testSelectPoolWithoutGroup() throws CommandException {


      _ci.command("psu set allpoolsactive on");
      _ci.command(new Args("psu create linkGroup h1-link-group"));
      _ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link"));


      PoolPreferenceLevel[] preference = _psu.match(
      "read",  // operation
      "h1:u1@osm",   // storage unit
      null,    // dCache unit
      "131.169.214.149", // net unit
      null,  // protocol
      null,  // map
      null); // linkGroup

      assertEquals("Only default read link have to be triggered", 1, preference.length);
      assertEquals("Only default read pool with attracion 0", 1, preference[0].getPoolList().size());
      assertEquals("Only default read pool with attracion 0 (default-read)", "default-read", preference[0].getPoolList().get(0));
      }
    */
/*
     * test case: check that we do not get pools from LinkGroup
     */
@Test
public void testSelectPoolByLinkGroup() throws CommandException {
    _ci.command("psu set allpoolsactive on");
    _ci.command(new Args("psu create linkGroup h1-link-group"));
    _ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link"));
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = _psu.match(// operation
    DirectionType.READ, // net unit
    "131.169.214.149", // protocol
    null, fileAttributes, // linkGroup
    "h1-link-group", defaultExclude);
    assertEquals("Only h1 read link have to be triggered", 1, preference.length);
    assertEquals("Only h1 read pool with attracion 0", 1, preference[0].getPoolList().size());
    assertEquals("Only h1 read pool with attracion 0 (h1-read)", "h1-read", preference[0].getPoolList().get(0));
}
Also used : Args(org.dcache.util.Args) PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) FileAttributes(org.dcache.vehicles.FileAttributes) Test(org.junit.Test)

Example 4 with PoolPreferenceLevel

use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.

the class PoolSelectionUnitTest method testSelectForP2P.

/*
     * test case: check that we do not select read-only pools as p2p
     * destinations.
     */
@Test
public void testSelectForP2P() throws CommandException {
    _ci.command("psu set allpoolsactive on");
    _ci.command("psu set pool h1-read rdonly");
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = // operation
    _psu.match(// operation
    DirectionType.P2P, // net unit
    "131.169.214.149", // protocol
    null, fileAttributes, null, // linkGroup
    defaultExclude);
    List<String> pools = new ArrayList<>();
    for (PoolPreferenceLevel level : preference) {
        pools.addAll(level.getPoolList());
    }
    assertEquals("More than expected pools selected", 1, pools.size());
    assertEquals("Unexpected pool selected", "default-read", pools.get(0));
}
Also used : PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) ArrayList(java.util.ArrayList) FileAttributes(org.dcache.vehicles.FileAttributes) Test(org.junit.Test)

Example 5 with PoolPreferenceLevel

use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.

the class PoolSelectionUnitTest method testH1ReadFallback.

/*
     * test case: check that if he pool is down, we get default pool
     */
@Test
public void testH1ReadFallback() throws CommandException {
    _ci.command("psu set allpoolsactive on");
    _ci.command("psu set disabled h1-read");
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = _psu.match(// operation
    DirectionType.READ, // net unit
    "131.169.214.149", // protocol
    null, fileAttributes, // linkGroup
    null, defaultExclude);
    assertEquals("H1 read link and default read link have to be triggered", 2, preference.length);
    assertEquals("No h1 pool when it's disabled with attracion 0", 0, preference[0].getPoolList().size());
    assertEquals("Only default read pool with attracion 0", 1, preference[1].getPoolList().size());
    assertEquals("Only default read pool with attracion 0 (default-read)", "default-read", preference[1].getPoolList().get(0));
}
Also used : PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) FileAttributes(org.dcache.vehicles.FileAttributes) Test(org.junit.Test)

Aggregations

PoolPreferenceLevel (diskCacheV111.poolManager.PoolPreferenceLevel)20 FileAttributes (org.dcache.vehicles.FileAttributes)19 Test (org.junit.Test)19 Args (org.dcache.util.Args)5 ArrayList (java.util.ArrayList)4 GenericStorageInfo (diskCacheV111.vehicles.GenericStorageInfo)3 StorageInfo (diskCacheV111.vehicles.StorageInfo)3 CacheException (diskCacheV111.util.CacheException)2 URI (java.net.URI)2 HashSet (java.util.HashSet)2 ImmutableList (com.google.common.collect.ImmutableList)1 SelectionPool (diskCacheV111.poolManager.PoolSelectionUnit.SelectionPool)1 PoolSelectionUnitV2 (diskCacheV111.poolManager.PoolSelectionUnitV2)1 PoolCostInfo (diskCacheV111.pools.PoolCostInfo)1 TimeoutCacheException (diskCacheV111.util.TimeoutCacheException)1 CellEndpoint (dmg.cells.nucleus.CellEndpoint)1 NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)1 CommandInterpreter (dmg.util.CommandInterpreter)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1