Search in sources :

Example 46 with Config

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);
}
Also used : BridgeEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) Nullable(javax.annotation.Nullable)

Example 47 with Config

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();
}
Also used : BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey) Nullable(javax.annotation.Nullable)

Example 48 with Config

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);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) TestExecBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExecBuilder) OuterList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList) TestExec(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec)

Example 49 with Config

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);
}
Also used : HashBrown(org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.HashBrown) WhiteBread(org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.WhiteBread) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 50 with Config

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());
        }
    }
}
Also used : Toaster(org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.Toaster) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)46 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12