Exemplo n.º 1
0
 private void postDataWithinTransaction(
     final DOMDataReadWriteTransaction rWTransaction,
     final LogicalDatastoreType datastore,
     final YangInstanceIdentifier path,
     final NormalizedNode<?, ?> payload,
     final SchemaContext schemaContext) {
   // FIXME: This is doing correct post for container and list children
   //        not sure if this will work for choice case
   if (payload instanceof MapNode) {
     LOG.trace(
         "POST {} within Restconf PATCH: {} with payload {}", datastore.name(), path, payload);
     final NormalizedNode<?, ?> emptySubtree = ImmutableNodes.fromInstanceId(schemaContext, path);
     rWTransaction.merge(
         datastore, YangInstanceIdentifier.create(emptySubtree.getIdentifier()), emptySubtree);
     ensureParentsByMerge(datastore, path, rWTransaction, schemaContext);
     for (final MapEntryNode child : ((MapNode) payload).getValue()) {
       final YangInstanceIdentifier childPath = path.node(child.getIdentifier());
       checkItemDoesNotExists(rWTransaction, datastore, childPath);
       rWTransaction.put(datastore, childPath, child);
     }
   } else {
     checkItemDoesNotExists(rWTransaction, datastore, path);
     ensureParentsByMerge(datastore, path, rWTransaction, schemaContext);
     rWTransaction.put(datastore, path, payload);
   }
 }
Exemplo n.º 2
0
 private void putDataWithinTransaction(
     final DOMDataReadWriteTransaction writeTransaction,
     final LogicalDatastoreType datastore,
     final YangInstanceIdentifier path,
     final NormalizedNode<?, ?> payload,
     final SchemaContext schemaContext) {
   LOG.trace("Put {} within Restconf PATCH: {} with payload {}", datastore.name(), path, payload);
   ensureParentsByMerge(datastore, path, writeTransaction, schemaContext);
   writeTransaction.put(datastore, path, payload);
 }
Exemplo n.º 3
0
 private CheckedFuture<Void, TransactionCommitFailedException> putDataViaTransaction(
     final DOMDataReadWriteTransaction writeTransaction,
     final LogicalDatastoreType datastore,
     final YangInstanceIdentifier path,
     final NormalizedNode<?, ?> payload,
     final SchemaContext schemaContext) {
   LOG.trace("Put {} via Restconf: {} with payload {}", datastore.name(), path, payload);
   ensureParentsByMerge(datastore, path, writeTransaction, schemaContext);
   writeTransaction.put(datastore, path, payload);
   return writeTransaction.submit();
 }