alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | */ |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 16 | package org.onosproject.net.meter; |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 17 | |
| 18 | import org.onosproject.event.ListenerService; |
alshabib | 70aaa1b | 2015-09-25 14:30:59 -0700 | [diff] [blame] | 19 | import org.onosproject.net.DeviceId; |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 20 | |
alshabib | 58fe6dc | 2015-08-19 17:16:13 -0700 | [diff] [blame] | 21 | import java.util.Collection; |
| 22 | |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Service for add/updating and removing meters. Meters are |
| 25 | * are assigned to flow to rate limit them and provide a certain |
| 26 | * quality of service. |
| 27 | */ |
| 28 | public interface MeterService |
| 29 | extends ListenerService<MeterEvent, MeterListener> { |
| 30 | |
| 31 | /** |
| 32 | * Adds a meter to the system and performs it installation. |
| 33 | * |
alshabib | e1248b6 | 2015-08-20 17:21:55 -0700 | [diff] [blame] | 34 | * @param meter a meter |
| 35 | * @return a meter (with a meter id) |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 36 | */ |
alshabib | e1248b6 | 2015-08-20 17:21:55 -0700 | [diff] [blame] | 37 | Meter submit(MeterRequest meter); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * Remove a meter from the system and the dataplane. |
| 41 | * |
| 42 | * @param meter a meter to remove |
alshabib | e1248b6 | 2015-08-20 17:21:55 -0700 | [diff] [blame] | 43 | * @param meterId the meter id of the meter to remove. |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 44 | */ |
alshabib | e1248b6 | 2015-08-20 17:21:55 -0700 | [diff] [blame] | 45 | void withdraw(MeterRequest meter, MeterId meterId); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Fetch the meter by the meter id. |
| 49 | * |
alshabib | 70aaa1b | 2015-09-25 14:30:59 -0700 | [diff] [blame] | 50 | * @param deviceId a device id |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 51 | * @param id a meter id |
| 52 | * @return a meter |
| 53 | */ |
alshabib | 70aaa1b | 2015-09-25 14:30:59 -0700 | [diff] [blame] | 54 | Meter getMeter(DeviceId deviceId, MeterId id); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
alshabib | 58fe6dc | 2015-08-19 17:16:13 -0700 | [diff] [blame] | 57 | * Fetches all the meters. |
| 58 | * |
| 59 | * @return a collection of meters |
| 60 | */ |
| 61 | Collection<Meter> getAllMeters(); |
| 62 | |
Jian Li | 1932b93 | 2016-01-03 00:35:40 -0800 | [diff] [blame] | 63 | /** |
| 64 | * Fetches the meters by the device id. |
| 65 | * |
| 66 | * @param deviceId a device id |
| 67 | * @return a collection of meters |
| 68 | */ |
| 69 | Collection<Meter> getMeters(DeviceId deviceId); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 70 | } |