2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.connect.netconf.util;
10 import java.util.Optional;
11 import org.opendaylight.yangtools.yang.data.api.ModifyAction;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 * Transforms rpc structures to normalized nodes and vice versa.
20 interface RpcStructureTransformer {
23 * Transforms data and path to the config element structure. It means creating of parent xml structure
24 * specified by path and appending data to the structure. Operation is set as attribute on data element.
26 * @param dataPath path, where data will be written
27 * @param operation operation
28 * @return config structure
30 AnyXmlNode createEditConfigStructure(Optional<NormalizedNode<?, ?>> data,
31 YangInstanceIdentifier dataPath, Optional<ModifyAction> operation);
34 * Transforms path to filter structure.
36 * @return filter structure
38 DataContainerChild<?,?> toFilterStructure(YangInstanceIdentifier path);
41 * Selects data specified by path from data node. Data must be product of get-config rpc with filter created by
42 * {@link #toFilterStructure(YangInstanceIdentifier)} with same path.
44 * @param path path to select
45 * @return selected data
47 Optional<NormalizedNode<?, ?>> selectFromDataStructure(
48 DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> data, YangInstanceIdentifier path);