use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project netvirt by opendaylight.
the class QosNeutronUtils method getBridgeEntryFromConfigDS.
@Nullable
private BridgeEntry getBridgeEntryFromConfigDS(BigInteger dpnId) {
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = getBridgeEntryIdentifier(bridgeEntryKey);
LOG.debug("Trying to retrieve bridge entry from config for Id: {}", bridgeEntryInstanceIdentifier);
return getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project netvirt by opendaylight.
the class QosNeutronUtils method getBridgeRefEntryFromOperDS.
@Nullable
private OvsdbBridgeRef getBridgeRefEntryFromOperDS(BigInteger dpId) {
BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpId);
InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = getBridgeRefEntryIdentifier(bridgeRefEntryKey);
BridgeRefEntry bridgeRefEntry = getBridgeRefEntryFromOperDS(bridgeRefEntryIid);
if (bridgeRefEntry == null) {
// bridge ref entry will be null if the bridge is disconnected from controller.
// In that case, fetch bridge reference from bridge interface entry config DS
BridgeEntry bridgeEntry = getBridgeEntryFromConfigDS(dpId);
if (bridgeEntry == null) {
return null;
}
return bridgeEntry.getBridgeReference();
}
return bridgeRefEntry.getBridgeReference();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project controller by opendaylight.
the class DsbenchmarkProvider method cleanupTestStore.
private void cleanupTestStore() {
TestExec data = new TestExecBuilder().setOuterList(Collections.<OuterList>emptyList()).build();
WriteTransaction tx = simpleTxDataBroker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID, data);
try {
tx.submit().checkedGet();
LOG.debug("DataStore config test data cleaned up");
} catch (final TransactionCommitFailedException e) {
LOG.info("Failed to cleanup DataStore configtest data");
throw new IllegalStateException(e);
}
tx = simpleTxDataBroker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data);
try {
tx.submit().checkedGet();
LOG.debug("DataStore operational test data cleaned up");
} catch (final TransactionCommitFailedException e) {
LOG.info("Failed to cleanup DataStore operational test data");
throw new IllegalStateException(e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project controller by opendaylight.
the class ToasterTest method testToaster.
@Test
public void testToaster() throws Exception {
MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName providerOn = new ObjectName("org.opendaylight.controller:name=OpendaylightToaster,type=toaster-provider");
long toastsMade = (long) platformMBeanServer.getAttribute(providerOn, "ToastsMade");
assertEquals(0, toastsMade);
boolean success = true;
// Make toasts using OSGi service
success &= kitchenService.makeBreakfast(EggsType.SCRAMBLED, HashBrown.class, 4).get().isSuccessful();
success &= kitchenService.makeBreakfast(EggsType.POACHED, WhiteBread.class, 8).get().isSuccessful();
assertTrue("Not all breakfasts succeeded", success);
// Verify toasts made count on provider via JMX/config-subsystem
toastsMade = (long) platformMBeanServer.getAttribute(providerOn, "ToastsMade");
assertEquals(2, toastsMade);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project controller by opendaylight.
the class OpendaylightToaster method onDataTreeChanged.
/**
* Implemented from the DataTreeChangeListener interface.
*/
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Toaster>> changes) {
for (DataTreeModification<Toaster> change : changes) {
DataObjectModification<Toaster> rootNode = change.getRootNode();
if (rootNode.getModificationType() == WRITE) {
Toaster oldToaster = rootNode.getDataBefore();
Toaster newToaster = rootNode.getDataAfter();
LOG.info("onDataTreeChanged - Toaster config with path {} was added or replaced: " + "old Toaster: {}, new Toaster: {}", change.getRootPath().getRootIdentifier(), oldToaster, newToaster);
Long darkness = newToaster.getDarknessFactor();
if (darkness != null) {
darknessFactor.set(darkness);
}
} else if (rootNode.getModificationType() == DELETE) {
LOG.info("onDataTreeChanged - Toaster config with path {} was deleted: old Toaster: {}", change.getRootPath().getRootIdentifier(), rootNode.getDataBefore());
}
}
}
Aggregations