blob: 546463cfd5c870f0695a7444e628f91423b211a9 [file] [log] [blame]
yoonseon1f518572017-01-03 17:27:26 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
yoonseon1f518572017-01-03 17:27:26 -08003 *
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.incubator.net.virtual.provider;
18
19import org.onosproject.incubator.net.virtual.NetworkId;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.provider.ProviderId;
22
23import java.util.Set;
24
25/**
26 * Registry for tracking information providers with the core.
27 */
28public 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 Hanc70b4e02016-10-20 15:24:33 -0700113 * Returns a virtual provider service corresponding to
114 * the virtual network and provider class type.
yoonseon1f518572017-01-03 17:27:26 -0800115 *
116 * @param networkId a virtual network identifier
Yoonseon Hanc70b4e02016-10-20 15:24:33 -0700117 * @param providerClass a type of virtual provider
yoonseon1f518572017-01-03 17:27:26 -0800118 * @return a virtual provider service
119 */
120 VirtualProviderService getProviderService(NetworkId networkId,
Yoonseon Hanc70b4e02016-10-20 15:24:33 -0700121 Class<? extends VirtualProvider> providerClass);
yoonseon1f518572017-01-03 17:27:26 -0800122}