Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 1 | /* |
| 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 Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 17 | package org.onosproject.netconf.client; |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 18 | |
| 19 | import org.onosproject.net.DeviceId; |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 20 | import org.onosproject.yang.model.ResourceData; |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 21 | import com.google.common.annotations.Beta; |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 22 | |
| 23 | import 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 |
| 30 | public interface NetconfTranslator { |
| 31 | /** |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 32 | * Retrieves and returns the configuration of the specified device. |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 33 | * |
| 34 | * @param deviceId the deviceID of the device to be contacted |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 35 | * @return a {@link ResourceData} containing the requested configuration |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 36 | * @throws IOException if serialization fails or the netconf subsystem is |
| 37 | * unable to handle the request |
| 38 | */ |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 39 | /*TODO a future version of this API will support an optional filter type.*/ |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 40 | ResourceData getDeviceConfig(DeviceId deviceId) throws IOException; |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 41 | |
| 42 | |
| 43 | /** |
| 44 | * Adds to, overwrites, or deletes the selected device's configuration in the scope |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 45 | * and manner specified by the ResourceData. |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 46 | * |
| 47 | * @param deviceId the deviceID fo the device to be contacted |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 48 | * @param resourceData the representation of the configuration to be pushed |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 49 | * to the device via NETCONF as well as the filter to |
| 50 | * be used. |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 51 | * @param operationType specifier for the type of edit operation to be |
| 52 | * performed (see enum for details) |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 53 | * @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 Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 57 | boolean editDeviceConfig(DeviceId deviceId, ResourceData resourceData, |
| 58 | OperationType operationType) throws IOException; |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 59 | |
| 60 | /* FIXME eventually expose the copy, delete, lock and unlock netconf methods */ |
| 61 | |
| 62 | /** |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 63 | * Returns the configuration and running statistics from the specified device. |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 64 | * |
| 65 | * @param deviceId the deviceID of the device to be contacted. |
Aaron Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 66 | * @return a {@link ResourceData} containing the requested configuration |
Aaron Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 67 | * 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 Kruglikov | bc26a52 | 2017-02-21 11:27:49 -0800 | [diff] [blame] | 73 | 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 Kruglikov | d1a1a40 | 2017-02-07 09:16:34 -0800 | [diff] [blame] | 88 | } |