Search in sources :

Example 11 with DOMDataWriteTransaction

use of org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction in project bgpcep by opendaylight.

the class BmpRouterPeerImpl method onStatsReports.

private synchronized void onStatsReports(final StatsReportsMessage statsReports) {
    if (this.up) {
        final DOMDataWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
        wTx.merge(LogicalDatastoreType.OPERATIONAL, this.peerYangIId.node(Stats.QNAME), createStats(statsReports, statsReports.getPeerHeader().getTimestampSec()));
        wTx.submit();
    }
}
Also used : DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 12 with DOMDataWriteTransaction

use of org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction in project bgpcep by opendaylight.

the class BmpRouterPeerImpl method onRouteMirror.

private synchronized void onRouteMirror(final RouteMirroringMessage mirror) {
    final DOMDataWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
    wTx.merge(LogicalDatastoreType.OPERATIONAL, this.peerYangIId.node(Mirrors.QNAME), createMirrors(mirror, mirror.getPeerHeader().getTimestampSec()));
    wTx.submit();
}
Also used : DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 13 with DOMDataWriteTransaction

use of org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction in project bgpcep by opendaylight.

the class BmpMonitoringStationImpl method createEmptyMonitor.

private synchronized void createEmptyMonitor() {
    final DOMDataWriteTransaction wTx = this.domDataBroker.newWriteOnlyTransaction();
    wTx.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().node(BmpMonitor.QNAME).node(Monitor.QNAME).nodeWithKey(Monitor.QNAME, MONITOR_ID_QNAME, this.monitorId.getValue()).build(), ImmutableNodes.mapEntryBuilder(Monitor.QNAME, MONITOR_ID_QNAME, this.monitorId.getValue()).addChild(ImmutableNodes.leafNode(MONITOR_ID_QNAME, this.monitorId.getValue())).addChild(ImmutableNodes.mapNodeBuilder(Router.QNAME).build()).build());
    try {
        wTx.submit().checkedGet();
    } catch (final TransactionCommitFailedException e) {
        LOG.error("Failed to initiate BMP Monitor {}.", this.monitorId.getValue(), e);
    }
}
Also used : TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 14 with DOMDataWriteTransaction

use of org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction in project bgpcep by opendaylight.

the class BmpRibInWriter method markTableUptodated.

private synchronized void markTableUptodated(final TablesKey tableTypes) {
    final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
    final TableContext ctxPre = this.tables.get(tableTypes);
    tx.merge(LogicalDatastoreType.OPERATIONAL, ctxPre.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_TRUE.getNodeType()), ATTRIBUTES_UPTODATE_TRUE);
    tx.submit();
}
Also used : DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Example 15 with DOMDataWriteTransaction

use of org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction in project controller by opendaylight.

the class SimpletxDomDelete method executeList.

@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();
    DOMDataWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
    long writeCnt = 0;
    for (int l = 0; l < outerListElem; l++) {
        YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
        tx.delete(dsType, yid);
        writeCnt++;
        if (writeCnt == writesPerTx) {
            try {
                tx.submit().checkedGet();
                txOk++;
            } catch (final TransactionCommitFailedException e) {
                LOG.error("Transaction failed: {}", e);
                txError++;
            }
            tx = domDataBroker.newWriteOnlyTransaction();
            writeCnt = 0;
        }
    }
    if (writeCnt != 0) {
        try {
            tx.submit().checkedGet();
        } catch (final TransactionCommitFailedException e) {
            LOG.error("Transaction failed: {}", e);
        }
    }
}
Also used : TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) QName(org.opendaylight.yangtools.yang.common.QName) DOMDataWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)

Aggregations

DOMDataWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)42 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)14 Test (org.junit.Test)11 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)11 NodeIdentifierWithPredicates (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates)9 CountDownLatch (java.util.concurrent.CountDownLatch)7 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)7 DataTreeCandidate (org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate)7 DataTreeCandidateNode (org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode)7 DOMDataTreeChangeService (org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService)6 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)5 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)5 DOMTransactionChain (org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain)4 QName (org.opendaylight.yangtools.yang.common.QName)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 DOMDataReadOnlyTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction)3 DOMDataReadWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction)3 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)3 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)3 InetSocketAddress (java.net.InetSocketAddress)2