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 | */ |
| 27 | public class NetconfSessionAdapter implements NetconfSession { |
| 28 | |
| 29 | @Override |
| 30 | public void startSubscription(String filterSchema) throws NetconfException { |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public void startSubscription() throws NetconfException { |
| 35 | } |
| 36 | |
| 37 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 38 | public String requestSync(String request) throws NetconfException { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public CompletableFuture<String> request(String request) |
| 44 | throws NetconfException { |
| 45 | return Tools.exceptionalFuture(new UnsupportedOperationException()); |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public void removeDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | public String getSessionId() { |
| 54 | return null; |
| 55 | } |
| 56 | |
| 57 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 58 | public String get(String filterSchema, String withDefaultsMode) |
| 59 | throws NetconfException { |
| 60 | return null; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public String get(String request) throws NetconfException { |
| 65 | return null; |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public void endSubscription() throws NetconfException { |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public boolean editConfig(String newConfiguration) throws NetconfException { |
| 74 | return true; |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public String doWrappedRpc(String request) throws NetconfException { |
| 79 | return null; |
| 80 | } |
| 81 | |
| 82 | @Override |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 83 | public boolean copyConfig(DatastoreId destination, DatastoreId source) |
| 84 | throws NetconfException { |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public boolean copyConfig(DatastoreId netconfTargetConfig, |
| 90 | String newConfiguration) |
| 91 | throws NetconfException { |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | @Override |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 96 | public boolean copyConfig(String netconfTargetConfig, |
| 97 | String newConfiguration) |
| 98 | throws NetconfException { |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public boolean close() throws NetconfException { |
| 104 | return true; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 109 | } |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 110 | |
| 111 | @Override |
| 112 | public String getConfig(DatastoreId netconfTargetConfig) |
| 113 | throws NetconfException { |
| 114 | return null; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public String getConfig(DatastoreId netconfTargetConfig, |
| 119 | String configurationFilterSchema) |
| 120 | throws NetconfException { |
| 121 | return null; |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public boolean editConfig(DatastoreId netconfTargetConfig, String mode, |
| 126 | String newConfiguration) |
| 127 | throws NetconfException { |
| 128 | return true; |
| 129 | } |
| 130 | |
| 131 | @Override |
| 132 | public boolean deleteConfig(DatastoreId netconfTargetConfig) |
| 133 | throws NetconfException { |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public boolean lock(DatastoreId datastore) throws NetconfException { |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public boolean unlock(DatastoreId datastore) throws NetconfException { |
| 144 | return true; |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public Set<String> getDeviceCapabilitiesSet() { |
| 149 | return Collections.emptySet(); |
| 150 | } |
Yuta HIGUCHI | 8810aa4 | 2017-08-02 15:05:37 -0700 | [diff] [blame] | 151 | } |