@Override public Collection<NormalizedNodeUpdate> normalizedUpdates(@Nonnull final YangInstanceIdentifier topLevelIdentifier, @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) { // identifier has different format : parent_node/list_node/list_node_with_key LOG.debug("Processing {} as list", topLevelIdentifier); return ((MapNode) entry.getValue()).getValue().stream() .map(mapEntryNode -> new NormalizedNodeUpdate(YangInstanceIdentifier.builder(topLevelIdentifier) .node(mapEntryNode.getNodeType()) .node(mapEntryNode.getIdentifier()).build(), mapEntryNode, null)) .collect(Collectors.toList()); } }
static Optional<RemoteYangSchema> createFromNormalizedNode(final RemoteDeviceId id, final MapEntryNode schemaNode) { Preconditions.checkArgument(schemaNode.getNodeType().equals(Schema.QNAME), "Wrong QName %s", schemaNode.getNodeType()); QName childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_FORMAT; String formatAsString = getSingleChildNodeValue(schemaNode, childNode).get(); if(formatAsString.equals(Yang.QNAME.toString()) == false) { LOG.debug("{}: Ignoring schema due to unsupported format: {}", id, formatAsString); return Optional.absent(); } childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_LOCATION; final Set<String> locationsAsString = getAllChildNodeValues(schemaNode, childNode); if(locationsAsString.contains(Schema.Location.Enumeration.NETCONF.toString()) == false) { LOG.debug("{}: Ignoring schema due to unsupported location: {}", id, locationsAsString); return Optional.absent(); } childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_NAMESPACE; final String namespaceAsString = getSingleChildNodeValue(schemaNode, childNode).get(); childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_VERSION; // Revision does not have to be filled final Optional<String> revisionAsString = getSingleChildNodeValue(schemaNode, childNode); childNode = NetconfMessageTransformUtil.IETF_NETCONF_MONITORING_SCHEMA_IDENTIFIER; final String moduleNameAsString = getSingleChildNodeValue(schemaNode, childNode).get(); final QName moduleQName = revisionAsString.isPresent() ? QName.create(namespaceAsString, revisionAsString.get(), moduleNameAsString) : QName.create(URI.create(namespaceAsString), null, moduleNameAsString); return Optional.of(new RemoteYangSchema(moduleQName)); }
@Override public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withChild(final MapEntryNode child) { DataValidationException.checkLegalChild(schema.getQName().equals(child.getNodeType()), child.getIdentifier(), schema, Collections.singleton(schema.getQName())); return super.withChild(child); }
@Override public CollectionNodeBuilder<MapEntryNode, MapNode> withChild(final MapEntryNode child) { DataValidationException.checkLegalChild(schema.getQName().equals(child.getNodeType()), child.getIdentifier(), schema, Collections.singleton(schema.getQName())); return super.withChild(child); }
@Override public CollectionNodeBuilder<MapEntryNode, MapNode> withChild(final MapEntryNode child) { DataValidationException.checkLegalChild(schema.getQName().equals(child.getNodeType()), child.getIdentifier(), schema, Collections.singleton(schema.getQName())); return super.withChild(child); }
@Override public CollectionNodeBuilder<MapEntryNode, OrderedMapNode> withChild(final MapEntryNode child) { DataValidationException.checkLegalChild(schema.getQName().equals(child.getNodeType()), child.getIdentifier(), schema, Collections.singleton(schema.getQName())); return super.withChild(child); }