本文整理汇总了Java中org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType类的典型用法代码示例。如果您正苦于以下问题:Java LogicalDatastoreType类的具体用法?Java LogicalDatastoreType怎么用?Java LogicalDatastoreType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogicalDatastoreType类属于org.opendaylight.controller.md.sal.common.api.data包,在下文中一共展示了LogicalDatastoreType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execWrite
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Override
ListenableFuture<Void> execWrite(final long txId) {
final int i = nextInt(MAX_ITEM + 1);
final YangInstanceIdentifier entryId =
idListItem.node(ITEM).node(new YangInstanceIdentifier.NodeIdentifierWithPredicates(ITEM, NUMBER, i));
final DOMDataWriteTransaction tx = createTransaction();
if (usedValues.contains(i)) {
LOG.debug("Deleting item: {}", i);
deleteTx++;
tx.delete(LogicalDatastoreType.CONFIGURATION, entryId);
usedValues.remove(i);
} else {
LOG.debug("Inserting item: {}", i);
insertTx++;
final MapEntryNode entry = ImmutableNodes.mapEntry(ITEM, NUMBER, i);
tx.put(LogicalDatastoreType.CONFIGURATION, entryId, entry);
usedValues.add(i);
}
return tx.submit();
}
示例2: init
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
/**
* Method called when the blueprint container is created.
*/
public void init() {
LOG.info("FpcProvider Session Initiated");
prepStore(LogicalDatastoreType.CONFIGURATION);
prepStore(LogicalDatastoreType.OPERATIONAL);
// Prepare the default Activators.
prepActivators();
assignmentService =
rpcRegistryDependency.addRpcImplementation(IetfDmmFpcagentService.class, new FpcagentDispatcher());
fpcCoreServices =
rpcRegistryDependency.addRpcImplementation(FpcService.class,
new FpcServiceImpl(this.dataBroker, this.notificationService, this.monitorService, this.activationService));
initJSON();
}
示例3: load
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
/**
* Loads the Connection Information from the data store
*/
private void load() {
ReadOnlyTransaction rtrans = dataBroker.newReadOnlyTransaction();
try {
Optional<ConnectionInfo> connInfo = rtrans.read(LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.create(ConnectionInfo.class)).get();
if (connInfo.isPresent()) {
for (Connections conn : (connInfo.get().getConnections() == null) ?
Collections.<Connections>emptyList() : connInfo.get().getConnections()) {
connections.put(conn.getAssignedInfo().getClientId().toString(), conn);
}
}
} catch (Exception exc) {
ErrorLog.logError("FpcServiceImpl - Error in loading Connection information from the datastore\n" + exc.getMessage(), exc.getStackTrace());
}
}
示例4: executeList
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
final org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
final YangInstanceIdentifier pid =
YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
try (DOMDataReadOnlyTransaction tx = domDataBroker.newReadOnlyTransaction()) {
for (int l = 0; l < outerListElem; l++) {
YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
Optional<NormalizedNode<?,?>> optionalDataObject;
CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture = tx.read(dsType, yid);
try {
optionalDataObject = submitFuture.checkedGet();
if (optionalDataObject != null && optionalDataObject.isPresent()) {
txOk++;
}
} catch (final ReadFailedException e) {
LOG.warn("failed to ....", e);
txError++;
}
}
}
}
示例5: testLazySubTransactionCreationForWriteOnlyTransactions
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Test
public void testLazySubTransactionCreationForWriteOnlyTransactions() {
DOMStore configDomStore = mock(DOMStore.class);
DOMStore operationalDomStore = mock(DOMStore.class);
DOMStoreWriteTransaction storeTxn = mock(DOMStoreWriteTransaction.class);
doReturn(storeTxn).when(operationalDomStore).newWriteOnlyTransaction();
doReturn(storeTxn).when(configDomStore).newWriteOnlyTransaction();
try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(
LogicalDatastoreType.OPERATIONAL, operationalDomStore, LogicalDatastoreType.CONFIGURATION,
configDomStore), futureExecutor)) {
DOMDataWriteTransaction dataTxn = dataBroker.newWriteOnlyTransaction();
dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
verify(configDomStore, never()).newWriteOnlyTransaction();
verify(operationalDomStore, times(1)).newWriteOnlyTransaction();
dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
verify(configDomStore, times(1)).newWriteOnlyTransaction();
verify(operationalDomStore, times(1)).newWriteOnlyTransaction();
}
}
示例6: doCreatePrefixShard
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
private void doCreatePrefixShard(final PrefixShardConfiguration config, final ShardIdentifier shardId,
final String shardName) {
configuration.addPrefixShardConfiguration(config);
final Builder builder = newShardDatastoreContextBuilder(shardName);
builder.logicalStoreType(LogicalDatastoreType.valueOf(config.getPrefix().getDatastoreType().name()))
.storeRoot(config.getPrefix().getRootIdentifier());
DatastoreContext shardDatastoreContext = builder.build();
final Map<String, String> peerAddresses = getPeerAddresses(shardName);
final boolean isActiveMember = true;
LOG.debug("{} doCreatePrefixShard: shardId: {}, memberNames: {}, peerAddresses: {}, isActiveMember: {}",
persistenceId(), shardId, config.getShardMemberNames(), peerAddresses, isActiveMember);
final ShardInformation info = new ShardInformation(shardName, shardId, peerAddresses,
shardDatastoreContext, Shard.builder(), peerAddressResolver);
info.setActiveMember(isActiveMember);
localShards.put(info.getShardName(), info);
if (schemaContext != null) {
info.setSchemaContext(schemaContext);
info.setActor(newShardActor(info));
}
}
示例7: read
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
checkState(root != null, "A modify operation (put, merge or delete) must be performed prior to a read operation");
final SettableFuture<Optional<NormalizedNode<?, ?>>> readResult = SettableFuture.create();
final Queue<Modification> currentHistory = Lists.newLinkedList(modificationHistoryMap.get(store));
Futures.addCallback(initialReadMap.get(store), new FutureCallback<Optional<NormalizedNode<?, ?>>>() {
@Override
public void onSuccess(@Nullable final Optional<NormalizedNode<?, ?>> result) {
final DataTreeModification mod = snapshotMap.get(store).newModification();
if (result.isPresent()) {
mod.write(path, result.get());
}
applyModificationHistoryToSnapshot(mod, currentHistory);
readResult.set(mod.readNode(path));
}
@Override
public void onFailure(final Throwable t) {
readResult.setException(t);
}
}, MoreExecutors.directExecutor());
return Futures.makeChecked(readResult, ReadFailedException.MAPPER);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
示例8: leafOnlyAugmentationDeletedTest
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Test
public void leafOnlyAugmentationDeletedTest() {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
assertCommit(writeTx.submit());
TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
AsyncDataBroker.DataChangeScope.SUBTREE);
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
assertCommit(writeTx.submit());
AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event = listener.event();
assertContains(event.getRemovedPaths(), SIMPLE_AUGMENT);
assertContains(event.getOriginalData(), SIMPLE_AUGMENT);
assertEmpty(event.getCreatedData());
assertEmpty(event.getUpdatedData());
}
示例9: testDataTreeChangeListener
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataTreeChangeListener() throws Exception {
DataBroker dataBroker = getDataBroker();
DataTreeChangeListener<ListItem> listener = mock(DataTreeChangeListener.class);
InstanceIdentifier<ListItem> wildCard = InstanceIdentifier.builder(ListenerTest.class)
.child(ListItem.class).build();
ListenerRegistration<DataTreeChangeListener<ListItem>> reg = dataBroker.registerDataTreeChangeListener(
new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, wildCard), listener);
final ListItem item = writeListItem();
ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
verify(listener, timeout(100)).onDataTreeChanged(captor.capture());
Collection<DataTreeModification<ListItem>> mods = captor.getValue();
assertEquals("ListItem", item, mods.iterator().next().getRootNode().getDataAfter());
}
示例10: setupStore
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Before
public void setupStore() {
InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER",
MoreExecutors.newDirectExecutorService());
InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
MoreExecutors.newDirectExecutorService());
schemaContext = TestModel.createTestContext();
operStore.onGlobalContextUpdated(schemaContext);
configStore.onGlobalContextUpdated(schemaContext);
ImmutableMap<LogicalDatastoreType, DOMStore> stores = ImmutableMap.<LogicalDatastoreType, DOMStore> builder() //
.put(CONFIGURATION, configStore) //
.put(OPERATIONAL, operStore) //
.build();
commitExecutor = new CommitExecutorService(Executors.newSingleThreadExecutor());
futureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 5, "FCB");
executor = new DeadlockDetectingListeningExecutorService(commitExecutor,
TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, futureExecutor);
domBroker = new SerializedDOMDataBroker(stores, executor);
}
示例11: setupStore
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@Before
public void setupStore() {
InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService());
schemaContext = TestModel.createTestContext();
operStore.onGlobalContextUpdated(schemaContext);
configStore.onGlobalContextUpdated(schemaContext);
ImmutableMap<LogicalDatastoreType, DOMStore> stores = ImmutableMap.<LogicalDatastoreType, DOMStore> builder() //
.put(CONFIGURATION, configStore) //
.put(OPERATIONAL, operStore) //
.build();
ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
domBroker = new SerializedDOMDataBroker(stores, executor);
}
示例12: testBasicProducer
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
/**
* A simple unbound producer. It write some basic things into the data store based on the
* test model.
* @throws DOMDataTreeProducerException
* @throws TransactionCommitFailedException
*/
@Test
public final void testBasicProducer() throws DOMDataTreeProducerException, TransactionCommitFailedException {
// Create a producer. It is an AutoCloseable resource, hence the try-with pattern
try (final DOMDataTreeProducer prod = service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) {
assertNotNull(prod);
final DOMDataWriteTransaction tx = prod.createTransaction(true);
assertNotNull(tx);
tx.put(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID, ImmutableContainerNodeBuilder.create().build());
final CheckedFuture<Void, TransactionCommitFailedException> f = tx.submit();
assertNotNull(f);
f.checkedGet();
}
}
示例13: allocateAndDelete
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
private static DOMDataReadWriteTransaction allocateAndDelete(final DOMTransactionChain txChain)
throws InterruptedException, ExecutionException {
DOMDataReadWriteTransaction tx = txChain.newReadWriteTransaction();
/**
* We test existence of /test in third transaction container should
* still be visible from first one (which is still uncommmited).
*
*/
assertTestContainerExists(tx);
/**
* We delete node in third transaction
*/
tx.delete(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH);
return tx;
}
示例14: onDataTreeChangedTest
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void onDataTreeChangedTest() {
InstanceIdentifier<Node> instanceIdentifierMock = mock(InstanceIdentifier.class);
DataTreeModification<Node> mockDataTreeModification = mock(DataTreeModification.class);
DataObjectModification<Node> mockModification = mock(DataObjectModification.class);
doReturn(mockModification).when(mockDataTreeModification).getRootNode();
doReturn(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, instanceIdentifierMock))
.when(mockDataTreeModification).getRootPath();
doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType();
Node dataObjectNodeMock = mock(Node.class);
doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).getKey();
NodeId nodeIdMock = mock(NodeId.class);
doReturn(nodeIdMock).when(dataObjectNodeMock).getNodeId();
doReturn("nodeIdPattern1").when(nodeIdMock).getValue();
doReturn(dataObjectNodeMock).when(mockModification).getDataAfter();
eventSourceTopic.onDataTreeChanged(Collections.singletonList(mockDataTreeModification));
verify(dataObjectNodeMock).getNodeId();
verify(nodeIdMock).getValue();
}
示例15: startNewDomDataBroker
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; //导入依赖的package包/类
public void startNewDomDataBroker() {
checkState(this.executor != null, "Executor needs to be set");
final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER",
MoreExecutors.newDirectExecutorService());
final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
MoreExecutors.newDirectExecutorService());
this.newDatastores = ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
.put(LogicalDatastoreType.OPERATIONAL, operStore)
.put(LogicalDatastoreType.CONFIGURATION, configStore)
.build();
this.newDOMDataBroker = new SerializedDOMDataBroker(this.newDatastores, this.executor);
this.mockSchemaService.registerSchemaContextListener(configStore);
this.mockSchemaService.registerSchemaContextListener(operStore);
}