yoonseon | 1f51857 | 2017-01-03 17:27:26 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
yoonseon | 1f51857 | 2017-01-03 17:27:26 -0800 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.incubator.net.virtual.provider; |
| 18 | |
| 19 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.provider.ProviderId; |
| 22 | |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Registry for tracking information providers with the core. |
| 27 | */ |
| 28 | public interface VirtualProviderRegistryService { |
| 29 | |
| 30 | /** |
| 31 | * Registers the supplied virtual provider. |
| 32 | * |
| 33 | * @param virtualProvider a virtual provider to be registered |
| 34 | * @throws java.lang.IllegalArgumentException if the provider is registered already |
| 35 | */ |
| 36 | void registerProvider(VirtualProvider virtualProvider); |
| 37 | |
| 38 | /** |
| 39 | * Unregisters the supplied virtual provider. |
| 40 | * As a result the previously issued virtual provider service will be invalidated |
| 41 | * and any subsequent invocations of its methods may throw |
| 42 | * {@link java.lang.IllegalStateException}. |
| 43 | * <p> |
| 44 | * Unregistering a virtual provider that has not been previously registered results |
| 45 | * in a no-op. |
| 46 | * </p> |
| 47 | * |
| 48 | * @param virtualProvider a virtual provider to be unregistered |
| 49 | */ |
| 50 | void unregisterProvider(VirtualProvider virtualProvider); |
| 51 | |
| 52 | /** |
| 53 | * Registers the supplied virtual provider. |
| 54 | * |
| 55 | * @param networkId a virtual network identifier |
| 56 | * @param virtualProviderService a virtual provider service to be registered |
| 57 | */ |
| 58 | void registerProviderService(NetworkId networkId, |
| 59 | VirtualProviderService virtualProviderService); |
| 60 | |
| 61 | /** |
| 62 | * Unregisters the supplied virtual provider service. |
| 63 | * |
| 64 | * @param networkId a virtual network identifier |
| 65 | * @param virtualProviderService a virtual provider service to be unregistered |
| 66 | */ |
| 67 | void unregisterProviderService(NetworkId networkId, |
| 68 | VirtualProviderService virtualProviderService); |
| 69 | |
| 70 | /** |
| 71 | * Returns a set of currently registered virtual provider identities. |
| 72 | * |
| 73 | * @return set of virtual provider identifiers |
| 74 | */ |
| 75 | Set<ProviderId> getProviders(); |
| 76 | |
| 77 | /** |
| 78 | * Returns a set of currently registered virtual provider identities |
| 79 | * corresponding to the requested providerService. |
| 80 | * |
| 81 | * @param virtualProviderService a virtual provider service |
| 82 | * @return set of virtual provider identifiers |
| 83 | */ |
| 84 | Set<ProviderId> getProvidersByService(VirtualProviderService virtualProviderService); |
| 85 | |
| 86 | /** |
| 87 | * Returns the virtual provider registered with the specified provider ID or null |
| 88 | * if none is found for the given provider family and default fall-back is |
| 89 | * not supported. |
| 90 | * |
| 91 | * @param providerId provider identifier |
| 92 | * @return provider |
| 93 | */ |
| 94 | VirtualProvider getProvider(ProviderId providerId); |
| 95 | |
| 96 | /** |
| 97 | * Returns the virtual provider for the specified device ID based on URI scheme. |
| 98 | * |
| 99 | * @param deviceId virtual device identifier |
| 100 | * @return provider bound to the URI scheme |
| 101 | */ |
| 102 | VirtualProvider getProvider(DeviceId deviceId); |
| 103 | |
| 104 | /** |
| 105 | * Returns the virtual provider registered with the specified scheme. |
| 106 | * |
| 107 | * @param scheme provider scheme |
| 108 | * @return provider |
| 109 | */ |
| 110 | VirtualProvider getProvider(String scheme); |
| 111 | |
| 112 | /** |
Yoonseon Han | c70b4e0 | 2016-10-20 15:24:33 -0700 | [diff] [blame] | 113 | * Returns a virtual provider service corresponding to |
| 114 | * the virtual network and provider class type. |
yoonseon | 1f51857 | 2017-01-03 17:27:26 -0800 | [diff] [blame] | 115 | * |
| 116 | * @param networkId a virtual network identifier |
Yoonseon Han | c70b4e0 | 2016-10-20 15:24:33 -0700 | [diff] [blame] | 117 | * @param providerClass a type of virtual provider |
yoonseon | 1f51857 | 2017-01-03 17:27:26 -0800 | [diff] [blame] | 118 | * @return a virtual provider service |
| 119 | */ |
| 120 | VirtualProviderService getProviderService(NetworkId networkId, |
Yoonseon Han | c70b4e0 | 2016-10-20 15:24:33 -0700 | [diff] [blame] | 121 | Class<? extends VirtualProvider> providerClass); |
yoonseon | 1f51857 | 2017-01-03 17:27:26 -0800 | [diff] [blame] | 122 | } |