blob: 73c435f6b7bb291a3837df6dbf6da086d8e7ae0e [file] [log] [blame]
andreaeb70a942015-10-16 21:34:46 -07001/*
2 * Copyright 2015 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
17package org.onosproject.netconf;
18
19import java.util.List;
20
21/**
22 * NETCONF session object that allows NETCONF operations on top with the physical
23 * device on top of an SSH connection.
24 */
25// TODO change return type of methdos to <Capability, XMLdoc, string or yang obj>
26public interface NetconfSession {
27
28 /**
29 * Retrives the requested configuration, different from get-config.
30 * @param request the XML containing the request to the server.
31 * @return device running configuration
32 */
33 String get(String request);
34
35 /**
36 * Executes an RPC to the server.
37 * @param request the XML containing the RPC for the server.
38 * @return Server response or ERROR
39 */
40 String doRPC(String request);
41
42 /**
43 * Retrives the specified configuration.
44 *
45 * @param targetConfiguration the type of configuration to retrieve.
46 * @return specified configuration.
47 */
48 String getConfig(String targetConfiguration);
49
50 /**
51 * Retrives part of the specivied configuration based on the filterSchema.
52 *
53 * @param targetConfiguration the type of configuration to retrieve.
54 * @param configurationFilterSchema XML schema to filter the configuration
55 * elements we are interested in
56 * @return device running configuration.
57 */
58 String getConfig(String targetConfiguration, String configurationFilterSchema);
59
60 /**
61 * Retrives part of the specified configuration based on the filterSchema.
62 *
63 * @param newConfiguration configuration to set
64 * @return true if the configuration was edited correctly
65 */
66
67 boolean editConfig(String newConfiguration);
68
69 /**
70 * Copies the new configuration, an Url or a complete configuration xml tree
71 * to the target configuration.
72 * The target configuration can't be the running one
73 *
74 * @param targetConfiguration the type of configuration to retrieve.
75 * @param newConfiguration configuration to set
76 * @return true if the configuration was copied correctly
77 */
78 boolean copyConfig(String targetConfiguration, String newConfiguration);
79
80 /**
81 * Deletes part of the specified configuration based on the filterSchema.
82 *
83 * @param targetConfiguration the name of the configuration to delete
84 * @return true if the configuration was copied correctly
85 */
86 boolean deleteConfig(String targetConfiguration);
87
88 /**
89 * Locks the candidate configuration.
90 *
91 * @return true if successful.
92 */
93 boolean lock();
94
95 /**
96 * Unlocks the candidate configuration.
97 *
98 * @return true if successful.
99 */
100 boolean unlock();
101
102 /**
103 * Closes the Netconf session with the device.
104 * the first time it tries gracefully, then kills it forcefully
105 * @return true if closed
106 */
107 boolean close();
108
109 /**
110 * Gets the session ID of the Netconf session.
111 *
112 * @return Session ID as a string.
113 */
114 String getSessionId();
115
116 /**
117 * Gets the capabilities of the Netconf server associated to this session.
118 *
119 * @return Network capabilities as a string.
120 */
121 String getServerCapabilities();
122
123 /**
124 * Sets the device capabilities.
125 * @param capabilities list of capabilities the device has.
126 */
127 void setDeviceCapabilities(List<String> capabilities);
128
129}