YangInstanceIdentifier testResultsPid = YangInstanceIdentifier.builder().node(TEST_RESULTS_QNAME).node(QName.create(TEST_RESULTS_QNAME, "test-result")).build(); YangInstanceIdentifier testResultPid = testResultsPid.node(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, resultNode.getIdentifier().getKeyValues()));
YangInstanceIdentifier iid = YangInstanceIdentifier.builder().node(net_topo).node(topo) .nodeWithKey(topo, topoId, "topology-netconf").node(fromNode) .nodeWithKey(fromNode, fromIdName, node_name).build();
return createContext(builder.toInstance(), ((DataSchemaNode) parentNode), mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema); final YangInstanceIdentifier partialPath = dataNormalizer.toNormalized(builder.build()); final Optional<DOMMountPoint> mountOpt = mountService.getMountPoint(partialPath); if (!mountOpt.isPresent()) { final YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance(); return new InstanceIdentifierContext<>(instance, mountPointSchema, mount,mountPointSchema); final RpcDefinition rpc = ControllerContext.getInstance().getRpcDefinition(head, module.getRevision()); if (rpc != null) { return new InstanceIdentifierContext<RpcDefinition>(builder.build(), rpc, mountPoint, mountPoint != null ? mountPoint.getSchemaContext() : globalSchema); builder.nodeWithKey(targetNode.getQName(), keyValues); } else { builder.node(targetNode.getQName()); return createContext(builder.build(), targetNode, mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema);
DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction(); YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build(); for (int l = 0; l < outerListElem; l++) { YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, l));
DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction(); YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build(); for (MapEntryNode element : this.list) { YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
NodeIdentifier datanode = NodeIdentifier.create(QName.create(PushUpdates.QNAME, "data")); YangInstanceIdentifier pid = YangInstanceIdentifier.builder() .node(PushUpdates.QNAME) .node(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.yangpush.rev150105.push.updates.PushUpdate.QNAME).build();
/** * Create new table instance * * @param tableTypes * @param yangTableRootIId * @param tx * @param registry * @return */ private ImmutableMap.Builder<TablesKey, TableContext> createTableInstance(final Set<TablesKey> tableTypes, final YangInstanceIdentifier yangTableRootIId, final DOMDataWriteTransaction tx, final RIBExtensionConsumerContext ribExtensions, final BindingCodecTree tree) { final ImmutableMap.Builder<TablesKey, TableContext> tb = ImmutableMap.builder(); for (final TablesKey k : tableTypes) { final RIBSupport rs = ribExtensions.getRIBSupport(k); if (rs == null) { LOG.warn("No support for table type {}, skipping it", k); continue; } final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(yangTableRootIId); final NodeIdentifierWithPredicates key = TablesUtil.toYangTablesKey(k); idb.nodeWithKey(key.getNodeType(), key.getKeyValues()); final TableContext ctx = new TableContext(rs, idb.build(), tree); ctx.createTable(tx); tx.put(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_FALSE.getNodeType()), ATTRIBUTES_UPTODATE_FALSE); LOG.debug("Created table instance {}", ctx.getTableId()); tb.put(k, ctx); } return tb; }
long writeCnt = 0; YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build(); for (MapEntryNode element : this.list) { YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
.node(TestExec.QNAME) .node(OuterList.QNAME) .nodeWithKey(OuterList.QNAME, OL_ID, l) .build();
private YangInstanceIdentifier checkConsistencyOfNormalizedNodeContext(final NormalizedNodeContext payload) { Preconditions.checkArgument(payload != null); Preconditions.checkArgument(payload.getData() != null); Preconditions.checkArgument(payload.getData().getNodeType() != null); Preconditions.checkArgument(payload.getInstanceIdentifierContext() != null); Preconditions.checkArgument(payload.getInstanceIdentifierContext().getInstanceIdentifier() != null); final QName payloadNodeQname = payload.getData().getNodeType(); final YangInstanceIdentifier yangIdent = payload.getInstanceIdentifierContext().getInstanceIdentifier(); if (payloadNodeQname.compareTo(yangIdent.getLastPathArgument().getNodeType()) > 0) { return yangIdent; } final InstanceIdentifierContext<?> parentContext = payload.getInstanceIdentifierContext(); final SchemaNode parentSchemaNode = parentContext.getSchemaNode(); if(parentSchemaNode instanceof DataNodeContainer) { final DataNodeContainer cast = (DataNodeContainer) parentSchemaNode; for (final DataSchemaNode child : cast.getChildNodes()) { if (payloadNodeQname.compareTo(child.getQName()) == 0) { return YangInstanceIdentifier.builder(yangIdent).node(child.getQName()).build(); } } } if (parentSchemaNode instanceof RpcDefinition) { return yangIdent; } final String errMsg = "Error parsing input: DataSchemaNode has not children "; LOG.info(errMsg + yangIdent); throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE); }
@Override public Set<NetconfOperation> getNetconfOperations() { TransactionProvider transactionProvider = new TransactionProvider(dataBroker, String.valueOf(currentSessionId)); CurrentSchemaContext currentSchemaContext = new CurrentSchemaContext(schemaService); ContainerNode netconf = createNetconfState(); YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().node(NetconfState.QNAME) .build(); final DOMDataWriteTransaction tx = dataBroker.newWriteOnlyTransaction(); tx.put(LogicalDatastoreType.OPERATIONAL, yangInstanceIdentifier, netconf); try { tx.submit().checkedGet(); LOG.debug("Netconf state updated successfully"); } catch (TransactionCommitFailedException e) { LOG.warn("Unable to update netconf state", e); } final Get get = new Get(String.valueOf(currentSessionId), currentSchemaContext, transactionProvider); final EditConfig editConfig = new EditConfig(String.valueOf(currentSessionId), currentSchemaContext, transactionProvider); final GetConfig getConfig = new GetConfig(String.valueOf(currentSessionId), currentSchemaContext, transactionProvider); final Commit commit = new Commit(String.valueOf(currentSessionId), transactionProvider); final Lock lock = new Lock(String.valueOf(currentSessionId)); final Unlock unLock = new Unlock(String.valueOf(currentSessionId)); final DiscardChanges discardChanges = new DiscardChanges(String.valueOf(currentSessionId), transactionProvider); return Sets.<NetconfOperation>newHashSet(get, getConfig, editConfig, commit, lock, unLock, discardChanges); }
@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(); try (DOMDataTreeReadTransaction tx = domDataBroker.newReadOnlyTransaction()) { for (int l = 0; l < outerListElem; l++) { YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l)); FluentFuture<java.util.Optional<NormalizedNode<?, ?>>> submitFuture = tx.read(dsType, yid); try { Optional<NormalizedNode<?,?>> optionalDataObject = submitFuture.get(); if (optionalDataObject != null && optionalDataObject.isPresent()) { NormalizedNode<?, ?> ret = optionalDataObject.get(); LOG.trace("optionalDataObject is {}", ret); txOk++; } else { txError++; LOG.warn("optionalDataObject is either null or .isPresent is false"); } } catch (final InterruptedException | ExecutionException e) { LOG.warn("failed to ....", e); txError++; } } } } }