Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | package org.onosproject.netconf; |
| 17 | |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 18 | import java.util.Collections; |
| 19 | import java.util.Set; |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 20 | import java.util.concurrent.CompletableFuture; |
| 21 | |
| 22 | import org.onlab.util.Tools; |
| 23 | |
| 24 | /** |
| 25 | * Adapter mainly intended for usage in tests. |
| 26 | */ |
Yuta HIGUCHI | 4f55c67 | 2018-06-14 18:10:43 -0700 | [diff] [blame] | 27 | public class NetconfSessionAdapter |
| 28 | extends AbstractNetconfSession |
| 29 | implements NetconfSession { |
| 30 | |
| 31 | // TODO remove methods defined in AbstractNetconfSession |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 32 | |
| 33 | @Override |
| 34 | public void startSubscription(String filterSchema) throws NetconfException { |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void startSubscription() throws NetconfException { |
| 39 | } |
| 40 | |
| 41 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 42 | public String requestSync(String request) throws NetconfException { |
| 43 | return null; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public CompletableFuture<String> request(String request) |
| 48 | throws NetconfException { |
| 49 | return Tools.exceptionalFuture(new UnsupportedOperationException()); |
| 50 | } |
| 51 | |
| 52 | @Override |
Yuta HIGUCHI | 4f55c67 | 2018-06-14 18:10:43 -0700 | [diff] [blame] | 53 | public CompletableFuture<String> rpc(String request) |
| 54 | throws NetconfException { |
| 55 | return Tools.exceptionalFuture(new UnsupportedOperationException()); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 60 | public void removeDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public String getSessionId() { |
| 65 | return null; |
| 66 | } |
| 67 | |
| 68 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 69 | public String get(String filterSchema, String withDefaultsMode) |
| 70 | throws NetconfException { |
| 71 | return null; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public String get(String request) throws NetconfException { |
| 76 | return null; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public void endSubscription() throws NetconfException { |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public boolean editConfig(String newConfiguration) throws NetconfException { |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public String doWrappedRpc(String request) throws NetconfException { |
| 90 | return null; |
| 91 | } |
| 92 | |
| 93 | @Override |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 94 | public boolean copyConfig(DatastoreId destination, DatastoreId source) |
| 95 | throws NetconfException { |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public boolean copyConfig(DatastoreId netconfTargetConfig, |
| 101 | String newConfiguration) |
| 102 | throws NetconfException { |
| 103 | return true; |
| 104 | } |
| 105 | |
| 106 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 107 | public boolean copyConfig(String netconfTargetConfig, |
| 108 | String newConfiguration) |
| 109 | throws NetconfException { |
| 110 | return true; |
| 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public boolean close() throws NetconfException { |
| 115 | return true; |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 120 | } |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 121 | |
| 122 | @Override |
| 123 | public String getConfig(DatastoreId netconfTargetConfig) |
| 124 | throws NetconfException { |
| 125 | return null; |
| 126 | } |
| 127 | |
| 128 | @Override |
| 129 | public String getConfig(DatastoreId netconfTargetConfig, |
| 130 | String configurationFilterSchema) |
| 131 | throws NetconfException { |
| 132 | return null; |
| 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public boolean editConfig(DatastoreId netconfTargetConfig, String mode, |
| 137 | String newConfiguration) |
| 138 | throws NetconfException { |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public boolean deleteConfig(DatastoreId netconfTargetConfig) |
| 144 | throws NetconfException { |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | @Override |
| 149 | public boolean lock(DatastoreId datastore) throws NetconfException { |
| 150 | return true; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public boolean unlock(DatastoreId datastore) throws NetconfException { |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | @Override |
| 159 | public Set<String> getDeviceCapabilitiesSet() { |
| 160 | return Collections.emptySet(); |
| 161 | } |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 162 | } |