Search in sources :

Example 1 with PoolSelectionUnitV2

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

the class PoolSelectionUnitTest method testRestrictedIPAddressExampleFromBook.

@Test
public void testRestrictedIPAddressExampleFromBook() throws CommandException {
    PoolSelectionUnitV2 psu = new PoolSelectionUnitV2();
    CommandInterpreter ci = new CommandInterpreter(psu);
    ci.command(new Args("psu create unit -store *@*"));
    ci.command(new Args("psu create pool read-pool"));
    ci.command(new Args("psu create pool write-pool"));
    ci.command(new Args("psu create pgroup read-pools"));
    ci.command(new Args("psu create pgroup write-pools"));
    ci.command(new Args("psu addto pgroup read-pools read-pool"));
    ci.command(new Args("psu addto pgroup write-pools write-pool"));
    ci.command(new Args("psu create unit -net 111.111.111.0/255.255.255.0"));
    ci.command(new Args("psu create ugroup allnet-cond"));
    ci.command(new Args("psu addto ugroup allnet-cond 111.111.111.0/255.255.255.0"));
    ci.command(new Args("psu create unit -net 111.111.111.201/255.255.255.255"));
    ci.command(new Args("psu create unit -net 111.111.111.202/255.255.255.255"));
    ci.command(new Args("psu create unit -net 111.111.111.203/255.255.255.255"));
    ci.command(new Args("psu create ugroup write-cond"));
    ci.command(new Args("psu addto ugroup write-cond 111.111.111.201/255.255.255.255"));
    ci.command(new Args("psu addto ugroup write-cond 111.111.111.202/255.255.255.255"));
    ci.command(new Args("psu addto ugroup write-cond 111.111.111.203/255.255.255.255"));
    ci.command(new Args("psu create link read-link allnet-cond"));
    ci.command(new Args("psu set link read-link -read-pref=10 -writepref=0 -cachepref=10"));
    ci.command(new Args("psu addto link read-link read-pools"));
    ci.command(new Args("psu create link write-link write-cond"));
    ci.command(new Args("psu set link write-link -readpref=0 -writepref=10 -cachepref=0"));
    ci.command(new Args("psu addto link write-link write-pools"));
    /* We cannot read from a write pool.
         */
    FileAttributes fileAttributes = new FileAttributes();
    StorageInfos.injectInto(GenericStorageInfo.valueOf("*", "*"), fileAttributes);
    PoolPreferenceLevel[] preference = // operation
    psu.match(// operation
    DirectionType.READ, // net unit
    "111.111.111.201", // protocol
    null, fileAttributes, // linkGroup
    null, defaultExclude);
    assertEquals(0, preference.length);
}
Also used : Args(org.dcache.util.Args) PoolPreferenceLevel(diskCacheV111.poolManager.PoolPreferenceLevel) PoolSelectionUnitV2(diskCacheV111.poolManager.PoolSelectionUnitV2) FileAttributes(org.dcache.vehicles.FileAttributes) CommandInterpreter(dmg.util.CommandInterpreter) Test(org.junit.Test)

Example 2 with PoolSelectionUnitV2

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

the class TestSelectionUnit method createPools.

private void createPools(PoolSelectionUnitV2 psu) {
    for (int i = 0; i < TestData.POOL_TYPE.length; ++i) {
        String prefix = TestData.POOL_TYPE[i];
        for (int k = 0; k < TestData.POOL_COUNT[i]; ++k) {
            String pool = prefix + k;
            psu.createPool(pool, false, false, false);
            psu.setActive(pool, true);
            psu.setPoolEnabled(pool);
            psu.getPool(pool).setPoolMode(new PoolV2Mode(PoolV2Mode.ENABLED));
        }
    }
}
Also used : PoolV2Mode(diskCacheV111.pools.PoolV2Mode)

Example 3 with PoolSelectionUnitV2

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

the class TestSelectionUnit method load.

void load() {
    PoolSelectionUnitV2 v2 = new PoolSelectionUnitV2();
    createUnits(v2);
    createUnitGroups(v2);
    createPools(v2);
    createPoolGroups(v2);
    createLinks(v2);
    psu = v2;
}
Also used : PoolSelectionUnitV2(diskCacheV111.poolManager.PoolSelectionUnitV2)

Example 4 with PoolSelectionUnitV2

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

the class HsmRestoreTest method setUp.

@Before
public void setUp() throws Exception {
    _counter = _counter + 1;
    _cell = new MockCellEndpoint("HsmRestoreTest" + _counter);
    _protocolInfo = new DCapProtocolInfo("DCap", 3, 0, new InetSocketAddress("127.0.0.1", 17));
    _storageInfo = new OSMStorageInfo("h1", "rawd");
    _partitionManager = new PartitionManager();
    PoolSelectionUnitV2 psu = new PoolSelectionUnitV2();
    _access = psu;
    _selectionUnit = psu;
    _costModule = new CostModuleV1();
    _pnfsHandler = new PnfsHandler(new CellPath("PnfsManager"));
    _pnfsHandler.setCellEndpoint(_cell);
    _poolMonitor = new PoolMonitorV5();
    _poolMonitor.setPoolSelectionUnit(_selectionUnit);
    _poolMonitor.setCostModule(_costModule);
    _poolMonitor.setPartitionManager(_partitionManager);
    /*
         * allow stage
         */
    _partitionManager.setProperties(null, ImmutableMap.of("stage-allowed", "yes"));
    _rc = new RequestContainerV5(RETRY_INTERVAL);
    _rc.setPoolSelectionUnit(_selectionUnit);
    _rc.setPnfsHandler(_pnfsHandler);
    _rc.setPoolMonitor(_poolMonitor);
    _rc.setPartitionManager(_partitionManager);
    _rc.setExecutor(MoreExecutors.directExecutor());
    _rc.setCellEndpoint(_cell);
    _rc.ac_rc_set_retry_$_1(new Args("0"));
    _rc.setStageConfigurationFile(null);
    _rc.setPnfsHandler(_pnfsHandler);
    _rc.start();
    __messages = new ArrayList<>();
}
Also used : CellPath(dmg.cells.nucleus.CellPath) MockCellEndpoint(org.dcache.tests.cells.MockCellEndpoint) Args(org.dcache.util.Args) PartitionManager(org.dcache.poolmanager.PartitionManager) InetSocketAddress(java.net.InetSocketAddress) PoolSelectionUnitV2(diskCacheV111.poolManager.PoolSelectionUnitV2) CostModuleV1(diskCacheV111.poolManager.CostModuleV1) PnfsHandler(diskCacheV111.util.PnfsHandler) OSMStorageInfo(diskCacheV111.vehicles.OSMStorageInfo) DCapProtocolInfo(diskCacheV111.vehicles.DCapProtocolInfo) PoolMonitorV5(diskCacheV111.poolManager.PoolMonitorV5) RequestContainerV5(diskCacheV111.poolManager.RequestContainerV5) Before(org.junit.Before)

Example 5 with PoolSelectionUnitV2

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

the class LinkGroupInfoTest method setUp.

@Before
public void setUp() throws Exception {
    PoolSelectionUnitV2 psu = new PoolSelectionUnitV2();
    _selectionUnit = psu;
    _costModule = new CostModuleV1();
    _ci = new CommandInterpreter(psu);
    _ci.command(new Args("psu create pool p0"));
    _ci.command(new Args("psu create pool p1"));
    _ci.command(new Args("psu create pool p2"));
    _ci.command(new Args("psu create pool p3"));
    _ci.command(new Args("psu create pool p4"));
    _ci.command(new Args("psu create pool p5"));
    _ci.command(new Args("psu create pool p6"));
    _ci.command(new Args("psu create pool p7"));
    _ci.command(new Args("psu create pgroup pg-a"));
    _ci.command(new Args("psu addto pgroup pg-a p0"));
    _ci.command(new Args("psu addto pgroup pg-a p1"));
    _ci.command(new Args("psu addto pgroup pg-a p2"));
    _ci.command(new Args("psu create pgroup pg-a-copy"));
    _ci.command(new Args("psu addto pgroup pg-a p0"));
    _ci.command(new Args("psu addto pgroup pg-a p1"));
    _ci.command(new Args("psu addto pgroup pg-a p2"));
    _ci.command(new Args("psu create pgroup pg-b"));
    _ci.command(new Args("psu addto pgroup pg-b p3"));
    _ci.command(new Args("psu addto pgroup pg-b p4"));
    _ci.command(new Args("psu addto pgroup pg-b p5"));
    _ci.command(new Args("psu create pgroup pg-c"));
    _ci.command(new Args("psu addto pgroup pg-c p6"));
    _ci.command(new Args("psu addto pgroup pg-c p7"));
    _ci.command(new Args("psu create unit -net    0.0.0.0/0.0.0.0"));
    _ci.command(new Args("psu create ugroup world-net"));
    _ci.command(new Args("psu addto ugroup world-net 0.0.0.0/0.0.0.0"));
    _ci.command(new Args("psu create unit -store  *@*"));
    _ci.command(new Args("psu create ugroup any-store"));
    _ci.command(new Args("psu addto ugroup any-store  *@*"));
    _ci.command(new Args("psu create link link-a any-store world-net"));
    _ci.command(new Args("psu set link link-a -readpref=20 -writepref=20 -cachepref=20"));
    _ci.command(new Args("psu addto link link-a pg-a"));
    _ci.command(new Args("psu addto link link-a pg-a-copy"));
    _ci.command(new Args("psu create link link-b any-store world-net"));
    _ci.command(new Args("psu set link link-b -readpref=20 -writepref=20 -cachepref=20"));
    _ci.command(new Args("psu addto link link-b pg-b"));
    _ci.command("psu set allpoolsactive on");
    _ci.command(new Args("psu create linkGroup link-ga"));
    _ci.command(new Args("psu addto linkGroup link-ga link-a"));
    _ci.command(new Args("psu addto linkGroup link-ga link-b"));
}
Also used : Args(org.dcache.util.Args) PoolSelectionUnitV2(diskCacheV111.poolManager.PoolSelectionUnitV2) CostModuleV1(diskCacheV111.poolManager.CostModuleV1) CommandInterpreter(dmg.util.CommandInterpreter) Before(org.junit.Before)

Aggregations

PoolSelectionUnitV2 (diskCacheV111.poolManager.PoolSelectionUnitV2)5 CostModuleV1 (diskCacheV111.poolManager.CostModuleV1)3 Args (org.dcache.util.Args)3 Before (org.junit.Before)3 PoolMonitorV5 (diskCacheV111.poolManager.PoolMonitorV5)2 CommandInterpreter (dmg.util.CommandInterpreter)2 PoolPreferenceLevel (diskCacheV111.poolManager.PoolPreferenceLevel)1 RequestContainerV5 (diskCacheV111.poolManager.RequestContainerV5)1 PoolV2Mode (diskCacheV111.pools.PoolV2Mode)1 PnfsHandler (diskCacheV111.util.PnfsHandler)1 PnfsId (diskCacheV111.util.PnfsId)1 DCapProtocolInfo (diskCacheV111.vehicles.DCapProtocolInfo)1 OSMStorageInfo (diskCacheV111.vehicles.OSMStorageInfo)1 CellPath (dmg.cells.nucleus.CellPath)1 InetSocketAddress (java.net.InetSocketAddress)1 PartitionManager (org.dcache.poolmanager.PartitionManager)1 MockCellEndpoint (org.dcache.tests.cells.MockCellEndpoint)1 FileAttributes (org.dcache.vehicles.FileAttributes)1 Test (org.junit.Test)1