use of org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType in project controller by opendaylight.
the class DOMDataTreeListenerTest method setupStore.
@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);
final 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", DOMDataTreeListenerTest.class);
executor = new DeadlockDetectingListeningExecutorService(commitExecutor, TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, futureExecutor);
domBroker = new SerializedDOMDataBroker(stores, executor);
}
use of org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType in project controller by opendaylight.
the class DOMTransactionChainTest method setupStore.
@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);
}
use of org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType in project controller by opendaylight.
the class DOMBrokerPerformanceTest method setupStore.
@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);
}
use of org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType in project netvirt by opendaylight.
the class ElanL2GatewayUtils method getRemoteUcastMacs.
/**
* Gets the remote ucast macs from hwvtep node filtering based on logical
* switch.
*
* @param hwvtepNodeId
* the hwvtep node id
* @param logicalSwitch
* the logical switch
* @param datastoreType
* the datastore type
* @return the remote ucast macs
*/
public List<MacAddress> getRemoteUcastMacs(NodeId hwvtepNodeId, String logicalSwitch, LogicalDatastoreType datastoreType) {
List<MacAddress> lstMacs = Collections.emptyList();
Node hwvtepNode = HwvtepUtils.getHwVtepNode(broker, datastoreType, hwvtepNodeId);
if (hwvtepNode != null) {
List<RemoteUcastMacs> remoteUcastMacs = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class).getRemoteUcastMacs();
if (remoteUcastMacs != null && !remoteUcastMacs.isEmpty()) {
// Filtering remoteUcastMacs based on the logical switch and
// forming a list of MacAddress
lstMacs = remoteUcastMacs.stream().filter(mac -> logicalSwitch.equals(mac.getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue())).map(HwvtepMacTableGenericAttributes::getMacEntryKey).collect(Collectors.toList());
}
}
return lstMacs;
}
use of org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType in project genius by opendaylight.
the class SingleTransactionDataBroker method syncUpdate.
public static <T extends DataObject> void syncUpdate(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data, int maxRetries) throws TransactionCommitFailedException {
RetryingManagedNewTransactionRunner runner = new RetryingManagedNewTransactionRunner(broker, maxRetries);
ListenableFutures.checkedGet(runner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(datastoreType, path, data, true)), SUBMIT_MAPPER);
}
Aggregations