NETCONF-608 - Change Netconf keepalives to not send during large payload replies
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / util / RpcStructureTransformer.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.sal.connect.netconf.util;
9
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;
16
17 /**
18  * Transforms rpc structures to normalized nodes and vice versa.
19  */
20 interface RpcStructureTransformer {
21
22     /**
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.
25      * @param data data
26      * @param dataPath path, where data will be written
27      * @param operation operation
28      * @return config structure
29      */
30     AnyXmlNode createEditConfigStructure(Optional<NormalizedNode<?, ?>> data,
31                                          YangInstanceIdentifier dataPath, Optional<ModifyAction> operation);
32
33     /**
34      * Transforms path to filter structure.
35      * @param path path
36      * @return filter structure
37      */
38     DataContainerChild<?,?> toFilterStructure(YangInstanceIdentifier path);
39
40     /**
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.
43      * @param data data
44      * @param path path to select
45      * @return selected data
46      */
47     Optional<NormalizedNode<?, ?>> selectFromDataStructure(
48             DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> data, YangInstanceIdentifier path);
49 }