Search in sources :

Example 46 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.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.mdsalutil.rev170830.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.mdsalutil.rev170830.Config in project bgpcep by opendaylight.

the class OpenconfigRoutingPolicyLoader method loadConfiguration.

@Override
public void loadConfiguration(final NormalizedNode<?, ?> dto) {
    final RoutingPolicy routingPolicy = (RoutingPolicy) this.bindingSerializer.fromNormalizedNode(this.routingPolicyYiid, dto).getValue();
    final WriteTransaction wtx = this.dataBroker.newWriteOnlyTransaction();
    wtx.merge(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID, routingPolicy, WriteTransaction.CREATE_MISSING_PARENTS);
    try {
        wtx.submit().get();
    } catch (final ExecutionException | InterruptedException e) {
        LOG.warn("Failed to create Routing Policy config", e);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) RoutingPolicy(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy) ExecutionException(java.util.concurrent.ExecutionException)

Example 49 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.Config in project bgpcep by opendaylight.

the class BmpMonitorConfigFileProcessor method loadConfiguration.

@Override
public synchronized void loadConfiguration(final NormalizedNode<?, ?> dto) {
    final ContainerNode bmpMonitorsConfigsContainer = (ContainerNode) dto;
    final MapNode monitorsList = (MapNode) bmpMonitorsConfigsContainer.getChild(this.bmpMonitorsYii.getLastPathArgument()).orElse(null);
    if (monitorsList == null) {
        return;
    }
    final Collection<MapEntryNode> bmpMonitorConfig = monitorsList.getValue();
    final WriteTransaction wtx = this.dataBroker.newWriteOnlyTransaction();
    bmpMonitorConfig.stream().map(topology -> this.bindingSerializer.fromNormalizedNode(this.bmpMonitorsYii, topology)).filter(Objects::nonNull).forEach(bi -> processBmpMonitorConfig((BmpMonitorConfig) bi.getValue(), wtx));
    try {
        wtx.submit().get();
    } catch (final ExecutionException | InterruptedException e) {
        LOG.warn("Failed to create Bmp config", e);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) BmpMonitorConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.BmpMonitorConfig) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) MapNode(org.opendaylight.yangtools.yang.data.api.schema.MapNode) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) ExecutionException(java.util.concurrent.ExecutionException)

Example 50 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.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)

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