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);
}
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));
}
}
}
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;
}
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<>();
}
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"));
}
Aggregations