+
+ LOG.error("Top level isn't of type container, list, leaf schema node but " + schema.getClass().getSimpleName());
+
+ throw new RestconfDocumentedException(new RestconfError(ErrorType.APPLICATION, ErrorTag.INVALID_VALUE,
+ "It wasn't possible to translate specified data to datastore readable form."));
+ }
+
+ private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
+ final InstanceIdentifierContext iiWithSchemaNode) {
+ return normalizeInstanceIdentifierWithSchemaNode(iiWithSchemaNode, false);
+ }
+
+ private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
+ final InstanceIdentifierContext iiWithSchemaNode, final boolean unwrapLastListNode) {
+ return new InstanceIdentifierContext(instanceIdentifierToReadableFormForNormalizeNode(
+ iiWithSchemaNode.getInstanceIdentifier(), unwrapLastListNode), iiWithSchemaNode.getSchemaNode(),
+ iiWithSchemaNode.getMountPoint(),iiWithSchemaNode.getSchemaContext());
+ }
+
+ private YangInstanceIdentifier instanceIdentifierToReadableFormForNormalizeNode(
+ final YangInstanceIdentifier instIdentifier, final boolean unwrapLastListNode) {
+ Preconditions.checkNotNull(instIdentifier, "Instance identifier can't be null");
+ final List<PathArgument> result = new ArrayList<PathArgument>();
+ final Iterator<PathArgument> iter = instIdentifier.getPathArguments().iterator();
+ while (iter.hasNext()) {
+ final PathArgument pathArgument = iter.next();
+ if (pathArgument instanceof NodeIdentifierWithPredicates && (iter.hasNext() || unwrapLastListNode)) {
+ result.add(new YangInstanceIdentifier.NodeIdentifier(pathArgument.getNodeType()));
+ }
+ result.add(pathArgument);
+ }
+ return YangInstanceIdentifier.create(result);
+ }
+
+ private CompositeNodeWrapper topLevelElementAsCompositeNodeWrapper(final NodeWrapper<?> node,
+ final DataSchemaNode schemaNode) {
+ if (node instanceof CompositeNodeWrapper) {
+ return (CompositeNodeWrapper) node;
+ } else if (node instanceof SimpleNodeWrapper && isDataContainerNode(schemaNode)) {
+ final SimpleNodeWrapper simpleNodeWrapper = (SimpleNodeWrapper) node;
+ return new CompositeNodeWrapper(namespace(simpleNodeWrapper), localName(simpleNodeWrapper));
+ }
+
+ throw new RestconfDocumentedException(new RestconfError(ErrorType.APPLICATION, ErrorTag.INVALID_VALUE,
+ "Top level element has to be composite node or has to represent data container node."));
+ }
+
+ private boolean isDataContainerNode(final DataSchemaNode schemaNode) {
+ if (schemaNode instanceof ContainerSchemaNode || schemaNode instanceof ListSchemaNode) {
+ return true;
+ }
+ return false;
+ }
+
+ public BigInteger getOperationalReceived() {
+ // TODO Auto-generated method stub
+ return null;