blob: b30a495f182c739631bf2cb3df4626c311741b82 [file] [log] [blame]
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -08001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080017package org.onosproject.netconf.client;
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080018
19import org.onosproject.net.DeviceId;
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080020import org.onosproject.yang.model.ResourceData;
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080021import com.google.common.annotations.Beta;
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080022
23import java.io.IOException;
24
25/**
26 * Interface for making some standard calls to NETCONF devices with
27 * serialization performed according the appropriate device's YANG model.
28 */
29@Beta
30public interface NetconfTranslator {
31 /**
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080032 * Retrieves and returns the configuration of the specified device.
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080033 *
34 * @param deviceId the deviceID of the device to be contacted
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080035 * @return a {@link ResourceData} containing the requested configuration
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080036 * @throws IOException if serialization fails or the netconf subsystem is
37 * unable to handle the request
38 */
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080039 /*TODO a future version of this API will support an optional filter type.*/
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080040 ResourceData getDeviceConfig(DeviceId deviceId) throws IOException;
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080041
42
43 /**
44 * Adds to, overwrites, or deletes the selected device's configuration in the scope
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080045 * and manner specified by the ResourceData.
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080046 *
47 * @param deviceId the deviceID fo the device to be contacted
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080048 * @param resourceData the representation of the configuration to be pushed
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080049 * to the device via NETCONF as well as the filter to
50 * be used.
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080051 * @param operationType specifier for the type of edit operation to be
52 * performed (see enum for details)
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080053 * @return a boolean, true if the operation succeeded, false otherwise
54 * @throws IOException if serialization fails or the netconf subsystem is
55 * unable to handle the request
56 */
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080057 boolean editDeviceConfig(DeviceId deviceId, ResourceData resourceData,
58 OperationType operationType) throws IOException;
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080059
60 /* FIXME eventually expose the copy, delete, lock and unlock netconf methods */
61
62 /**
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080063 * Returns the configuration and running statistics from the specified device.
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080064 *
65 * @param deviceId the deviceID of the device to be contacted.
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080066 * @return a {@link ResourceData} containing the requested configuration
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080067 * and statistics
68 * @throws IOException if serialization fails or the netconf subsystem is
69 * unable to handle the request
70 */
71 /*TODO a future version of this API will support an optional filter type.*/
72
Aaron Kruglikovbc26a522017-02-21 11:27:49 -080073 ResourceData getDeviceState(DeviceId deviceId) throws IOException;
74
75 /**
76 * Specifiers for the operations types when calling editConfig.
77 */
78 public static enum OperationType {
79 /**
80 * Deletes the specified nodes.
81 */
82 DELETE,
83 /**
84 * Replaces the specified nodes.
85 */
86 REPLACE
87 }
Aaron Kruglikovd1a1a402017-02-07 09:16:34 -080088}