- final CompositeNode schemasNode =
- (CompositeNode) NetconfMessageTransformUtil.findNode(schemasNodeResult.getResult(), DATA_STATE_SCHEMAS_IDENTIFIER);
- if(schemasNode == null) {
- logger.warn("{}: Unable to detect available schemas, get to {} was empty", id, STATE_SCHEMAS_IDENTIFIER);
+ final Optional<? extends NormalizedNode<?, ?>> schemasNode = findSchemasNode(schemasNodeResult.getResult());
+
+ if(schemasNode.isPresent()) {
+ Preconditions.checkState(schemasNode.get() instanceof ContainerNode,
+ "Expecting container containing schemas, but was %s", schemasNode.get());
+ return create(id, ((ContainerNode) schemasNode.get()));
+ } else {
+ LOG.warn("{}: Unable to detect available schemas, get to {} was empty", id, STATE_SCHEMAS_IDENTIFIER);