import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
* Util class for read data from data store via transaction.
public static @Nullable NormalizedNode<?, ?> readData(final @NonNull String valueOfContent,
final @NonNull YangInstanceIdentifier path,
final @NonNull RestconfStrategy strategy,
- final String withDefa, final SchemaContext ctx) {
+ final String withDefa, final EffectiveModelContext ctx) {
switch (valueOfContent) {
case RestconfDataServiceConstant.ReadData.CONFIG:
if (withDefa == null) {
}
private static NormalizedNode<?, ?> prepareDataByParamWithDef(final NormalizedNode<?, ?> result,
- final YangInstanceIdentifier path, final String withDefa, final SchemaContext ctx) {
+ final YangInstanceIdentifier path, final String withDefa, final EffectiveModelContext ctx) {
boolean trim;
switch (withDefa) {
case "trim":
}
final DataSchemaContextTree baseSchemaCtxTree = DataSchemaContextTree.from(ctx);
- final DataSchemaNode baseSchemaNode = baseSchemaCtxTree.getChild(path).getDataSchemaNode();
+ final DataSchemaNode baseSchemaNode = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (result instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder =
Builders.containerBuilder((ContainerSchemaNode) baseSchemaNode);
final YangInstanceIdentifier actualPath, final boolean trim, final List<QName> keys) {
for (final DataContainerChild<? extends PathArgument, ?> child : result.getValue()) {
final YangInstanceIdentifier path = actualPath.node(child.getIdentifier());
- final DataSchemaNode childSchema = baseSchemaCtxTree.getChild(path).getDataSchemaNode();
+ final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (child instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> childBuilder =
Builders.containerBuilder((ContainerSchemaNode) childSchema);
final List<QName> keys) {
for (final MapEntryNode mapEntryNode : result.getValue()) {
final YangInstanceIdentifier actualNode = path.node(mapEntryNode.getIdentifier());
- final DataSchemaNode childSchema = baseSchemaCtxTree.getChild(actualNode).getDataSchemaNode();
+ final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(actualNode).orElseThrow()
+ .getDataSchemaNode();
final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder =
Builders.mapEntryBuilder((ListSchemaNode) childSchema);
buildMapEntryBuilder(mapEntryBuilder, mapEntryNode, baseSchemaCtxTree, actualNode, trim, keys);
final YangInstanceIdentifier actualPath, final boolean trim) {
for (final DataContainerChild<? extends PathArgument, ?> child : result.getValue()) {
final YangInstanceIdentifier path = actualPath.node(child.getIdentifier());
- final DataSchemaNode childSchema = baseSchemaCtxTree.getChild(path).getDataSchemaNode();
+ final DataSchemaNode childSchema = baseSchemaCtxTree.findChild(path).orElseThrow().getDataSchemaNode();
if (child instanceof ContainerNode) {
final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builderChild =
Builders.containerBuilder((ContainerSchemaNode) childSchema);
* @return {@link NormalizedNode}
*/
private static @Nullable NormalizedNode<?, ?> readAllData(final @NonNull RestconfStrategy strategy,
- final YangInstanceIdentifier path, final String withDefa, final SchemaContext ctx) {
+ final YangInstanceIdentifier path, final String withDefa, final EffectiveModelContext ctx) {
// PREPARE STATE DATA NODE
final NormalizedNode<?, ?> stateDataNode = readDataViaTransaction(
strategy, LogicalDatastoreType.OPERATIONAL, path, false);