Jian Li | 7564231 | 2017-01-19 14:23:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present 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 | package org.onosproject.mapping; |
| 17 | |
Jian Li | 2dc9f00 | 2017-03-03 04:26:31 +0900 | [diff] [blame] | 18 | import org.onosproject.core.ApplicationId; |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 19 | import org.onosproject.event.ListenerService; |
Jian Li | 2dc9f00 | 2017-03-03 04:26:31 +0900 | [diff] [blame] | 20 | import org.onosproject.mapping.MappingStore.Type; |
| 21 | import org.onosproject.net.DeviceId; |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 22 | |
Jian Li | 7564231 | 2017-01-19 14:23:05 -0800 | [diff] [blame] | 23 | /** |
| 24 | * Interface of mapping management service. |
| 25 | */ |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 26 | public interface MappingService |
Jian Li | 2dc9f00 | 2017-03-03 04:26:31 +0900 | [diff] [blame] | 27 | extends ListenerService<MappingEvent, MappingListener> { |
| 28 | |
| 29 | /** |
| 30 | * Obtains the number of mappings in the system. |
| 31 | * |
| 32 | * @param type mapping store type |
| 33 | * @return mapping count |
| 34 | */ |
| 35 | int getMappingCount(Type type); |
| 36 | |
| 37 | /** |
| 38 | * Stores a mapping entry. |
| 39 | * |
| 40 | * @param type mapping store type |
| 41 | * @param entry mapping entry to be stored |
| 42 | */ |
| 43 | void storeMappingEntry(Type type, MappingEntry entry); |
| 44 | |
| 45 | /** |
| 46 | * Obtains the collection of mapping entries applied on the specific device. |
| 47 | * The will include mapping which may not yet have been applied to device. |
| 48 | * |
| 49 | * @param type mapping store type |
| 50 | * @param deviceId device identifier |
| 51 | * @return collection of mapping entries |
| 52 | */ |
| 53 | Iterable<MappingEntry> getMappingEntries(Type type, DeviceId deviceId); |
| 54 | |
| 55 | /** |
| 56 | * Obtains the collection of mapping entries with a given application ID. |
| 57 | * |
| 58 | * @param type mapping store type |
| 59 | * @param appId application identifier |
| 60 | * @return collection of mapping entries |
| 61 | */ |
| 62 | Iterable<MappingEntry> getMappingEntriesByAddId(Type type, ApplicationId appId); |
| 63 | |
| 64 | /** |
| 65 | * Removes the specified mapping entries from their respective devices and |
| 66 | * mapping store. |
| 67 | * |
| 68 | * @param type mapping store type |
| 69 | * @param entries one or more mapping entries |
| 70 | */ |
| 71 | void removeMappingEntries(Type type, MappingEntry... entries); |
| 72 | |
| 73 | /** |
| 74 | * Removes all mapping entries submitted by a particular application. |
| 75 | * |
| 76 | * @param type mapping store type |
| 77 | * @param appId identifier of application whose mapping entries will be removed |
| 78 | */ |
| 79 | void removeMappingEntriesByAppId(Type type, ApplicationId appId); |
| 80 | |
| 81 | /** |
| 82 | * Purges all mappings on the specified device and mapping store. |
| 83 | * Note that the mappings will only be removed from storage, the mappings |
| 84 | * are still remaining in the device. |
| 85 | * |
| 86 | * @param type mapping store type |
| 87 | * @param deviceId device identifier |
| 88 | */ |
| 89 | void purgeMappings(Type type, DeviceId deviceId); |
Jian Li | 7564231 | 2017-01-19 14:23:05 -0800 | [diff] [blame] | 90 | } |